Skip to main content

Debug Tools for Python.

Project description

author: Ilya Shalyapin, www.ishalyapin.ru

Installation

pip install dt

Usage

First of all you need to import debug tools.

import dt

Quick text saving to temp file

>>> text = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit...'
>>> dt.save(text)
'/tmp/tmpSTTRow'

Run “less” from python

>>> text = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit...'
>>> dt.less(text)

Run ack-grep from python

>>> text = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit...'
>>> dt.grep('-i lorem', text)
Lorem ipsum dolor sit amet, consectetur adipiscing elit...

Easy XML-formatting

>>> xml = u'<data><item>hellow world</item></data>'
>>> dt.xmlprint(xml)
<settings>
  <a>hellow world</a>
</settings>

Display stings in nested objects in human readable format

There is to functions for that pprint and uprint. First function output is easy to read, but in some cases it might not work. The second works in any cases.

>>> data = [u'лимон', u'апельсин', {u'фрукты':(u'мандарины',)}]
>>> print data
[u'\u043b\u0438\u043c\u043e\u043d', u'\u0430\u043f\u0435\u043b\u044c\u0441\u0438\u043d', {u'\u0444\u0440\u0443\u043a\u0442\u044b': (u'\u043c\u0430\u043d\u0434\u0430\u0440\u0438\u043d\u044b',)}]
>>> dt.uprint(data)
["лимон", "апельсин", {"фрукты":("мандарины",),},]
>>> dt.pprint(data)
[u'лимон',
 u'апельсин',
 {u'фрукты': (u'мандарины',)}]
>>>

Project details


Release history Release notifications

This version

0.2

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for dt, version 0.2
Filename, size File type Python version Upload date Hashes
Filename, size dt-0.2.tar.gz (2.7 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page