Skip to main content

Annoying helper module that finds unicode/bytestring comparisions and other problems.

Project description

// The Unicode Nazi //

Once enabled the unicode nazi will complain whenever something is not purely unicode or bytestring. It’s annoying as hell and only useful when porting over libraries from Python 2 to Python 3. It has a huge runtime impact on performance and will also complain about most of the stuff in the Python standard library.

  • usage:

    >>> import unicodenazi
    >>> 'foo' == u'foo'
    __main__:1: UnicodeWarning: Implicit conversion of str to unicode
    True
    
  • how to disable it again:

    >>> unicodenazi.disable()
    
  • and here is how to enable:

    >>> unicodenazi.enable()
    
  • if you want to enable it only for a given block:

    >>> unicodenazi.disable()
    >>> with unicodenazi.blockwise(enabled=True):
    ...  assert 'foo' == u'foo'
    ...
    __main__:2: UnicodeWarning: Implicit conversion of str to unicode
    

    The reverse works too of course.

Project details


Download files

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

Source Distribution

unicode-nazi-1.0.tar.gz (1.9 kB view details)

Uploaded Source

File details

Details for the file unicode-nazi-1.0.tar.gz.

File metadata

  • Download URL: unicode-nazi-1.0.tar.gz
  • Upload date:
  • Size: 1.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for unicode-nazi-1.0.tar.gz
Algorithm Hash digest
SHA256 5c47275de67ae6bdfc5ca10c2ffbce57d269c6498b572f04350f9b2e898e2522
MD5 97366a81eaf4f0c3cbf405a24172834a
BLAKE2b-256 9757610d12c4386f7fca0287ea628d35b67cab1ea10e18521a04e891e51bf3cd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page