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.

The module can be used from a command line:

$ python -municodenazi your_script.py [script_args..]

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.1.tar.gz (2.2 kB view details)

Uploaded Source

File details

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

File metadata

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

File hashes

Hashes for unicode-nazi-1.1.tar.gz
Algorithm Hash digest
SHA256 5be37c62cfa750d0a58693d9c63b6e95f6932675e3939c4cdd60151631ac04fc
MD5 f9b3d2c25c7887df643e67e2c8d99c45
BLAKE2b-256 664f70344391454973af0fcc70bcea02e9f78ead8e82b5ea82b0d01eb0ea753f

See more details on using hashes here.

Supported by

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