<commit_before>from PyQt4.QtGui import *
from PyQt4.QtCore import *
import PyQt4.QtCore as QtCore
import PyQt4.QtGui as QtGui

import bmp, pyqrnative


class QRCodeWidget(QWidget):

    def __init__(self, data = None, size=4):
        QWidget.__init__(self)
        self.setMinimumSize(210, 210)
        self.addr = None
        self.qr = None
        self.size = size
        if data:
            self.set_addr(data)
            self.update_qr()

    def set_addr(self, addr):
        if self.addr != addr:
            self.addr = addr
            self.qr = None
            self.update()

    def update_qr(self):
        if self.addr and not self.qr:
            self.qr = pyqrnative.QRCode(self.size, pyqrnative.QRErrorCorrectLevel.L)
            self.qr.addData(self.addr)
            self.qr.make()
            self.update()<commit_msg>qr codes: handle exception raised if the string is too long<commit_after>from PyQt4.QtGui import *
from PyQt4.QtCore import *
import PyQt4.QtCore as QtCore
import PyQt4.QtGui as QtGui

import bmp, pyqrnative


class QRCodeWidget(QWidget):

    def __init__(self, data = None, size=4):
        QWidget.__init__(self)
        self.setMinimumSize(210, 210)
        self.addr = None
        self.qr = None
        self.size = size
        if data:
            self.set_addr(data)
            self.update_qr()

    def set_addr(self, addr):
        if self.addr != addr:
            self.addr = addr
            self.qr = None
            self.update()

    def update_qr(self):
        if self.addr and not self.qr:
            self.qr = pyqrnative.QRCode(self.size, pyqrnative.QRErrorCorrectLevel.L)
            self.qr.addData(self.addr)
            try:
                self.qr.make()
            except:
                self.qr=None
            self.update()
{'fraction_non_alphanumeric': 0.09388888888888888, 'fraction_numerical': 0.012222222222222223, 'mean_word_length': 1.8362204724409448, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7515085', 'n_tokens_mistral': 613, 'n_tokens_neox': 558, 'n_words': 134}