Python pprint.html() Examples
The following are 30
code examples of pprint.html().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
pprint
, or try the search function
.
Example #1
Source File: pyparsing.py From insights-core with Apache License 2.0 | 5 votes |
def pprint(self, *args, **kwargs): """Pretty-printer for parsed results as a list, using the C{pprint} module. Accepts additional positional or keyword args as defined for the C{pprint.pprint} method. (U{http://docs.python.org/3/library/pprint.html#pprint.pprint})""" pprint.pprint(self.asList(), *args, **kwargs) # add support for pickle protocol
Example #2
Source File: results.py From cmt with MIT License | 5 votes |
def pprint(self, *args, **kwargs): """ Pretty-printer for parsed results as a list, using the `pprint <https://docs.python.org/3/library/pprint.html>`_ module. Accepts additional positional or keyword args as defined for `pprint.pprint <https://docs.python.org/3/library/pprint.html#pprint.pprint>`_ . Example:: ident = Word(alphas, alphanums) num = Word(nums) func = Forward() term = ident | num | Group('(' + func + ')') func <<= ident + Group(Optional(delimitedList(term))) result = func.parseString("fna a,b,(fnb c,d,200),100") result.pprint(width=40) prints:: ['fna', ['a', 'b', ['(', 'fnb', ['c', 'd', '200'], ')'], '100']] """ pprint.pprint(self.asList(), *args, **kwargs) # add support for pickle protocol
Example #3
Source File: results.py From pyparsing with MIT License | 5 votes |
def pprint(self, *args, **kwargs): """ Pretty-printer for parsed results as a list, using the `pprint <https://docs.python.org/3/library/pprint.html>`_ module. Accepts additional positional or keyword args as defined for `pprint.pprint <https://docs.python.org/3/library/pprint.html#pprint.pprint>`_ . Example:: ident = Word(alphas, alphanums) num = Word(nums) func = Forward() term = ident | num | Group('(' + func + ')') func <<= ident + Group(Optional(delimitedList(term))) result = func.parseString("fna a,b,(fnb c,d,200),100") result.pprint(width=40) prints:: ['fna', ['a', 'b', ['(', 'fnb', ['c', 'd', '200'], ')'], '100']] """ pprint.pprint(self.asList(), *args, **kwargs) # add support for pickle protocol
Example #4
Source File: pyparsing.py From syntheticmass with Apache License 2.0 | 5 votes |
def pprint(self, *args, **kwargs): """Pretty-printer for parsed results as a list, using the C{pprint} module. Accepts additional positional or keyword args as defined for the C{pprint.pprint} method. (U{http://docs.python.org/3/library/pprint.html#pprint.pprint})""" pprint.pprint(self.asList(), *args, **kwargs) # add support for pickle protocol
Example #5
Source File: pyparsing.py From syntheticmass with Apache License 2.0 | 5 votes |
def pprint(self, *args, **kwargs): """Pretty-printer for parsed results as a list, using the C{pprint} module. Accepts additional positional or keyword args as defined for the C{pprint.pprint} method. (U{http://docs.python.org/3/library/pprint.html#pprint.pprint})""" pprint.pprint(self.asList(), *args, **kwargs) # add support for pickle protocol
Example #6
Source File: pyparsing.py From syntheticmass with Apache License 2.0 | 5 votes |
def _ustr(obj): """Drop-in replacement for str(obj) that tries to be Unicode friendly. It first tries str(obj). If that fails with a UnicodeEncodeError, then it tries unicode(obj). It then < returns the unicode object | encodes it with the default encoding | ... >. """ if isinstance(obj,unicode): return obj try: # If this works, then _ustr(obj) has the same behaviour as str(obj), so # it won't break any existing code. return str(obj) except UnicodeEncodeError: # The Python docs (http://docs.python.org/ref/customization.html#l2h-182) # state that "The return value must be a string object". However, does a # unicode object (being a subclass of basestring) count as a "string # object"? # If so, then return a unicode object: return unicode(obj) # Else encode it... but how? There are many choices... :) # Replace unprintables with escape codes? #return unicode(obj).encode(sys.getdefaultencoding(), 'backslashreplace_errors') # Replace unprintables with question marks? #return unicode(obj).encode(sys.getdefaultencoding(), 'replace') # ... # build list of single arg builtins, tolerant of Python version, that can be used as parse actions
Example #7
Source File: pyparsing.py From ZEROScan with MIT License | 5 votes |
def pprint(self, *args, **kwargs): """Pretty-printer for parsed results as a list, using the C{pprint} module. Accepts additional positional or keyword args as defined for the C{pprint.pprint} method. (U{http://docs.python.org/3/library/pprint.html#pprint.pprint})""" pprint.pprint(self.asList(), *args, **kwargs) # add support for pickle protocol
Example #8
Source File: pyparsing.py From ZEROScan with MIT License | 5 votes |
def _ustr(obj): """Drop-in replacement for str(obj) that tries to be Unicode friendly. It first tries str(obj). If that fails with a UnicodeEncodeError, then it tries unicode(obj). It then < returns the unicode object | encodes it with the default encoding | ... >. """ if isinstance(obj,unicode): return obj try: # If this works, then _ustr(obj) has the same behaviour as str(obj), so # it won't break any existing code. return str(obj) except UnicodeEncodeError: # The Python docs (http://docs.python.org/ref/customization.html#l2h-182) # state that "The return value must be a string object". However, does a # unicode object (being a subclass of basestring) count as a "string # object"? # If so, then return a unicode object: return unicode(obj) # Else encode it... but how? There are many choices... :) # Replace unprintables with escape codes? #return unicode(obj).encode(sys.getdefaultencoding(), 'backslashreplace_errors') # Replace unprintables with question marks? #return unicode(obj).encode(sys.getdefaultencoding(), 'replace') # ... # build list of single arg builtins, tolerant of Python version, that can be used as parse actions
Example #9
Source File: pyparsing.py From ImageFusion with MIT License | 5 votes |
def pprint(self, *args, **kwargs): """Pretty-printer for parsed results as a list, using the C{pprint} module. Accepts additional positional or keyword args as defined for the C{pprint.pprint} method. (U{http://docs.python.org/3/library/pprint.html#pprint.pprint})""" pprint.pprint(self.asList(), *args, **kwargs) # add support for pickle protocol
Example #10
Source File: pyparsing.py From ImageFusion with MIT License | 5 votes |
def _ustr(obj): """Drop-in replacement for str(obj) that tries to be Unicode friendly. It first tries str(obj). If that fails with a UnicodeEncodeError, then it tries unicode(obj). It then < returns the unicode object | encodes it with the default encoding | ... >. """ if isinstance(obj,unicode): return obj try: # If this works, then _ustr(obj) has the same behaviour as str(obj), so # it won't break any existing code. return str(obj) except UnicodeEncodeError: # The Python docs (http://docs.python.org/ref/customization.html#l2h-182) # state that "The return value must be a string object". However, does a # unicode object (being a subclass of basestring) count as a "string # object"? # If so, then return a unicode object: return unicode(obj) # Else encode it... but how? There are many choices... :) # Replace unprintables with escape codes? #return unicode(obj).encode(sys.getdefaultencoding(), 'backslashreplace_errors') # Replace unprintables with question marks? #return unicode(obj).encode(sys.getdefaultencoding(), 'replace') # ... # build list of single arg builtins, tolerant of Python version, that can be used as parse actions
Example #11
Source File: __init__.py From patzilla with GNU Affero General Public License v3.0 | 5 votes |
def pyparsing_parseresults_pformat(self, *args, **kwargs): """ Pretty-print formatter for parsed results as a list, using the C{pprint} module. Accepts additional positional or keyword args as defined for the C{pprint.pformat} method. (U{http://docs.python.org/3/library/pprint.html#pprint.pformat}) """ return pprint.pformat(self.asList(), *args, **kwargs)
Example #12
Source File: pyparsing.py From PocHunter with MIT License | 5 votes |
def pprint(self, *args, **kwargs): """Pretty-printer for parsed results as a list, using the C{pprint} module. Accepts additional positional or keyword args as defined for the C{pprint.pprint} method. (U{http://docs.python.org/3/library/pprint.html#pprint.pprint})""" pprint.pprint(self.asList(), *args, **kwargs) # add support for pickle protocol
Example #13
Source File: pyparsing.py From PocHunter with MIT License | 5 votes |
def _ustr(obj): """Drop-in replacement for str(obj) that tries to be Unicode friendly. It first tries str(obj). If that fails with a UnicodeEncodeError, then it tries unicode(obj). It then < returns the unicode object | encodes it with the default encoding | ... >. """ if isinstance(obj, unicode): return obj try: # If this works, then _ustr(obj) has the same behaviour as str(obj), so # it won't break any existing code. return str(obj) except UnicodeEncodeError: # The Python docs (http://docs.python.org/ref/customization.html#l2h-182) # state that "The return value must be a string object". However, does a # unicode object (being a subclass of basestring) count as a "string # object"? # If so, then return a unicode object: return unicode(obj) # Else encode it... but how? There are many choices... :) # Replace unprintables with escape codes? #return unicode(obj).encode(sys.getdefaultencoding(), 'backslashreplace_errors') # Replace unprintables with question marks? #return unicode(obj).encode(sys.getdefaultencoding(), 'replace') # ... # build list of single arg builtins, tolerant of Python version, that can be used as parse actions
Example #14
Source File: pyparsing.py From Financial-Portfolio-Flask with MIT License | 5 votes |
def pprint(self, *args, **kwargs): """Pretty-printer for parsed results as a list, using the C{pprint} module. Accepts additional positional or keyword args as defined for the C{pprint.pprint} method. (U{http://docs.python.org/3/library/pprint.html#pprint.pprint})""" pprint.pprint(self.asList(), *args, **kwargs) # add support for pickle protocol
Example #15
Source File: pyparsing.py From cadquery-freecad-module with GNU Lesser General Public License v3.0 | 5 votes |
def pprint(self, *args, **kwargs): """Pretty-printer for parsed results as a list, using the C{pprint} module. Accepts additional positional or keyword args as defined for the C{pprint.pprint} method. (U{http://docs.python.org/3/library/pprint.html#pprint.pprint})""" pprint.pprint(self.asList(), *args, **kwargs) # add support for pickle protocol
Example #16
Source File: pyparsing.py From vulscan with MIT License | 5 votes |
def _ustr(obj): """Drop-in replacement for str(obj) that tries to be Unicode friendly. It first tries str(obj). If that fails with a UnicodeEncodeError, then it tries unicode(obj). It then < returns the unicode object | encodes it with the default encoding | ... >. """ if isinstance(obj,unicode): return obj try: # If this works, then _ustr(obj) has the same behaviour as str(obj), so # it won't break any existing code. return str(obj) except UnicodeEncodeError: # The Python docs (http://docs.python.org/ref/customization.html#l2h-182) # state that "The return value must be a string object". However, does a # unicode object (being a subclass of basestring) count as a "string # object"? # If so, then return a unicode object: return unicode(obj) # Else encode it... but how? There are many choices... :) # Replace unprintables with escape codes? #return unicode(obj).encode(sys.getdefaultencoding(), 'backslashreplace_errors') # Replace unprintables with question marks? #return unicode(obj).encode(sys.getdefaultencoding(), 'replace') # ... # build list of single arg builtins, tolerant of Python version, that can be used as parse actions
Example #17
Source File: pyparsing.py From alive with Apache License 2.0 | 5 votes |
def pprint(self, *args, **kwargs): """Pretty-printer for parsed results as a list, using the C{pprint} module. Accepts additional positional or keyword args as defined for the C{pprint.pprint} method. (U{http://docs.python.org/3/library/pprint.html#pprint.pprint})""" pprint.pprint(self.asList(), *args, **kwargs) # add support for pickle protocol
Example #18
Source File: pyparsing.py From alive with Apache License 2.0 | 5 votes |
def _ustr(obj): """Drop-in replacement for str(obj) that tries to be Unicode friendly. It first tries str(obj). If that fails with a UnicodeEncodeError, then it tries unicode(obj). It then < returns the unicode object | encodes it with the default encoding | ... >. """ if isinstance(obj,unicode): return obj try: # If this works, then _ustr(obj) has the same behaviour as str(obj), so # it won't break any existing code. return str(obj) except UnicodeEncodeError: # The Python docs (http://docs.python.org/ref/customization.html#l2h-182) # state that "The return value must be a string object". However, does a # unicode object (being a subclass of basestring) count as a "string # object"? # If so, then return a unicode object: return unicode(obj) # Else encode it... but how? There are many choices... :) # Replace unprintables with escape codes? #return unicode(obj).encode(sys.getdefaultencoding(), 'backslashreplace_errors') # Replace unprintables with question marks? #return unicode(obj).encode(sys.getdefaultencoding(), 'replace') # ... # build list of single arg builtins, tolerant of Python version, that can be used as parse actions
Example #19
Source File: pyparsing.py From matplotlib-4-abaqus with MIT License | 5 votes |
def pprint(self, *args, **kwargs): """Pretty-printer for parsed results as a list, using the C{pprint} module. Accepts additional positional or keyword args as defined for the C{pprint.pprint} method. (U{http://docs.python.org/3/library/pprint.html#pprint.pprint})""" pprint.pprint(self.asList(), *args, **kwargs) # add support for pickle protocol
Example #20
Source File: pyparsing.py From matplotlib-4-abaqus with MIT License | 5 votes |
def _ustr(obj): """Drop-in replacement for str(obj) that tries to be Unicode friendly. It first tries str(obj). If that fails with a UnicodeEncodeError, then it tries unicode(obj). It then < returns the unicode object | encodes it with the default encoding | ... >. """ if isinstance(obj,unicode): return obj try: # If this works, then _ustr(obj) has the same behaviour as str(obj), so # it won't break any existing code. return str(obj) except UnicodeEncodeError: # The Python docs (http://docs.python.org/ref/customization.html#l2h-182) # state that "The return value must be a string object". However, does a # unicode object (being a subclass of basestring) count as a "string # object"? # If so, then return a unicode object: return unicode(obj) # Else encode it... but how? There are many choices... :) # Replace unprintables with escape codes? #return unicode(obj).encode(sys.getdefaultencoding(), 'backslashreplace_errors') # Replace unprintables with question marks? #return unicode(obj).encode(sys.getdefaultencoding(), 'replace') # ... # build list of single arg builtins, tolerant of Python version, that can be used as parse actions
Example #21
Source File: pyparsing.py From Mastering-Elasticsearch-7.0 with MIT License | 5 votes |
def pprint(self, *args, **kwargs): """Pretty-printer for parsed results as a list, using the C{pprint} module. Accepts additional positional or keyword args as defined for the C{pprint.pprint} method. (U{http://docs.python.org/3/library/pprint.html#pprint.pprint})""" pprint.pprint(self.asList(), *args, **kwargs) # add support for pickle protocol
Example #22
Source File: pyparsing.py From Mastering-Elasticsearch-7.0 with MIT License | 5 votes |
def _ustr(obj): """Drop-in replacement for str(obj) that tries to be Unicode friendly. It first tries str(obj). If that fails with a UnicodeEncodeError, then it tries unicode(obj). It then < returns the unicode object | encodes it with the default encoding | ... >. """ if isinstance(obj,unicode): return obj try: # If this works, then _ustr(obj) has the same behaviour as str(obj), so # it won't break any existing code. return str(obj) except UnicodeEncodeError: # The Python docs (http://docs.python.org/ref/customization.html#l2h-182) # state that "The return value must be a string object". However, does a # unicode object (being a subclass of basestring) count as a "string # object"? # If so, then return a unicode object: return unicode(obj) # Else encode it... but how? There are many choices... :) # Replace unprintables with escape codes? #return unicode(obj).encode(sys.getdefaultencoding(), 'backslashreplace_errors') # Replace unprintables with question marks? #return unicode(obj).encode(sys.getdefaultencoding(), 'replace') # ... # build list of single arg builtins, tolerant of Python version, that can be used as parse actions
Example #23
Source File: pyparsing.py From Mastering-Elasticsearch-7.0 with MIT License | 5 votes |
def pprint(self, *args, **kwargs): """Pretty-printer for parsed results as a list, using the C{pprint} module. Accepts additional positional or keyword args as defined for the C{pprint.pprint} method. (U{http://docs.python.org/3/library/pprint.html#pprint.pprint})""" pprint.pprint(self.asList(), *args, **kwargs) # add support for pickle protocol
Example #24
Source File: pyparsing.py From Mastering-Elasticsearch-7.0 with MIT License | 5 votes |
def _ustr(obj): """Drop-in replacement for str(obj) that tries to be Unicode friendly. It first tries str(obj). If that fails with a UnicodeEncodeError, then it tries unicode(obj). It then < returns the unicode object | encodes it with the default encoding | ... >. """ if isinstance(obj,unicode): return obj try: # If this works, then _ustr(obj) has the same behaviour as str(obj), so # it won't break any existing code. return str(obj) except UnicodeEncodeError: # The Python docs (http://docs.python.org/ref/customization.html#l2h-182) # state that "The return value must be a string object". However, does a # unicode object (being a subclass of basestring) count as a "string # object"? # If so, then return a unicode object: return unicode(obj) # Else encode it... but how? There are many choices... :) # Replace unprintables with escape codes? #return unicode(obj).encode(sys.getdefaultencoding(), 'backslashreplace_errors') # Replace unprintables with question marks? #return unicode(obj).encode(sys.getdefaultencoding(), 'replace') # ... # build list of single arg builtins, tolerant of Python version, that can be used as parse actions
Example #25
Source File: pyparsing.py From phpsploit with GNU General Public License v3.0 | 5 votes |
def pprint(self, *args, **kwargs): """Pretty-printer for parsed results as a list, using the C{pprint} module. Accepts additional positional or keyword args as defined for the C{pprint.pprint} method. (U{http://docs.python.org/3/library/pprint.html#pprint.pprint})""" pprint.pprint(self.asList(), *args, **kwargs) # add support for pickle protocol
Example #26
Source File: pyparsing.py From kobo-predict with BSD 2-Clause "Simplified" License | 5 votes |
def pprint(self, *args, **kwargs): """Pretty-printer for parsed results as a list, using the C{pprint} module. Accepts additional positional or keyword args as defined for the C{pprint.pprint} method. (U{http://docs.python.org/3/library/pprint.html#pprint.pprint})""" pprint.pprint(self.asList(), *args, **kwargs) # add support for pickle protocol
Example #27
Source File: pyparsing.py From jbox with MIT License | 5 votes |
def pprint(self, *args, **kwargs): """Pretty-printer for parsed results as a list, using the C{pprint} module. Accepts additional positional or keyword args as defined for the C{pprint.pprint} method. (U{http://docs.python.org/3/library/pprint.html#pprint.pprint})""" pprint.pprint(self.asList(), *args, **kwargs) # add support for pickle protocol
Example #28
Source File: pyparsing.py From jbox with MIT License | 5 votes |
def pprint(self, *args, **kwargs): """Pretty-printer for parsed results as a list, using the C{pprint} module. Accepts additional positional or keyword args as defined for the C{pprint.pprint} method. (U{http://docs.python.org/3/library/pprint.html#pprint.pprint})""" pprint.pprint(self.asList(), *args, **kwargs) # add support for pickle protocol
Example #29
Source File: pyparsing.py From jbox with MIT License | 5 votes |
def _ustr(obj): """Drop-in replacement for str(obj) that tries to be Unicode friendly. It first tries str(obj). If that fails with a UnicodeEncodeError, then it tries unicode(obj). It then < returns the unicode object | encodes it with the default encoding | ... >. """ if isinstance(obj,unicode): return obj try: # If this works, then _ustr(obj) has the same behaviour as str(obj), so # it won't break any existing code. return str(obj) except UnicodeEncodeError: # The Python docs (http://docs.python.org/ref/customization.html#l2h-182) # state that "The return value must be a string object". However, does a # unicode object (being a subclass of basestring) count as a "string # object"? # If so, then return a unicode object: return unicode(obj) # Else encode it... but how? There are many choices... :) # Replace unprintables with escape codes? #return unicode(obj).encode(sys.getdefaultencoding(), 'backslashreplace_errors') # Replace unprintables with question marks? #return unicode(obj).encode(sys.getdefaultencoding(), 'replace') # ... # build list of single arg builtins, tolerant of Python version, that can be used as parse actions
Example #30
Source File: pyparsing.py From vulscan with MIT License | 5 votes |
def pprint(self, *args, **kwargs): """Pretty-printer for parsed results as a list, using the C{pprint} module. Accepts additional positional or keyword args as defined for the C{pprint.pprint} method. (U{http://docs.python.org/3/library/pprint.html#pprint.pprint})""" pprint.pprint(self.asList(), *args, **kwargs) # add support for pickle protocol