<commit_before>"""
This package is an abstraction layer over the various different Qt bindings
for python (PyQt5, PyQt4 and PySide).

It mimics the structure of PyQt5 but let you choose the binding to use through
the ``QT_API`` environment variable.

PyQt5
~~~~~

For pyqt5, you don't have to set anything

>>>from pyqode.qt import QtGui, QtWidgets, QtCore
>>>print(QtWidgets.QWidget)

PyQt4
~~~~~

Set the QT_API environment variable to 'PyQt4' (case insensitive)

>>>import os
>>>os.environ['QT_API'] = 'PyQt4'
>>>from pyqode.qt import QtGui, QtWidgets, QtCore
>>>print(QtWidgets.QWidget)

PySide
~~~~~~

Set the QT_API environment variable to 'PySide' (case insensitive)

>>>import os
>>>os.environ['QT_API'] = 'PySide'
>>>from pyqode.qt import QtGui, QtWidgets, QtCore
>>>print(QtWidgets.QWidget)


The role of this module is to check ``QT_API`` based on the available bindings.
"""
import os
import sys
import logging

__version__ = '1.2.dev'


QT_API = 'QT_API'
PYQT5_API = 'pyqt5'
PYQT4_API = 'pyqt4'
PYSIDE_API = 'pyside'


class PythonQtError(Exception):
    pass

def setup_apiv2():
    """
    Setup apiv2 on the chose binding.
    """
    # setup PyQt api to version 2
    if sys.version_info[0] == 2:
        try:
            import sip
            sip.setapi("QString", 2)<commit_msg>One unique version number across all official namespace packages<commit_after>"""
This package is an abstraction layer over the various different Qt bindings
for python (PyQt5, PyQt4 and PySide).

It mimics the structure of PyQt5 but let you choose the binding to use through
the ``QT_API`` environment variable.

PyQt5
~~~~~

For pyqt5, you don't have to set anything

>>>from pyqode.qt import QtGui, QtWidgets, QtCore
>>>print(QtWidgets.QWidget)

PyQt4
~~~~~

Set the QT_API environment variable to 'PyQt4' (case insensitive)

>>>import os
>>>os.environ['QT_API'] = 'PyQt4'
>>>from pyqode.qt import QtGui, QtWidgets, QtCore
>>>print(QtWidgets.QWidget)

PySide
~~~~~~

Set the QT_API environment variable to 'PySide' (case insensitive)

>>>import os
>>>os.environ['QT_API'] = 'PySide'
>>>from pyqode.qt import QtGui, QtWidgets, QtCore
>>>print(QtWidgets.QWidget)


The role of this module is to check ``QT_API`` based on the available bindings.
"""
import os
import sys
import logging

__version__ = '2.4.dev'


QT_API = 'QT_API'
PYQT5_API = 'pyqt5'
PYQT4_API = 'pyqt4'
PYSIDE_API = 'pyside'


class PythonQtError(Exception):
    pass

def setup_apiv2():
    """
    Setup apiv2 on the chose binding.
    """
    # setup PyQt api to version 2
    if sys.version_info[0] == 2:
        try:
            import sip
            sip.setapi("QString", 2)
{'fraction_non_alphanumeric': 0.11862485833018512, 'fraction_numerical': 0.01511144692104269, 'mean_word_length': 4.102119460500964, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 63, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1164955', 'n_tokens_mistral': 941, 'n_tokens_neox': 899, 'n_words': 309}