<commit_before>#!/usr/bin/python

from xml.sax.saxutils import XMLFilterBase, XMLGenerator
from xml.sax.xmlreader import AttributesImpl
from xml.sax import make_parser
import sys

def AttributesUnion(base, **values):
	baseitems = dict(base)
	baseitems.update(values)
	return AttributesImpl(baseitems)

class AnnotateType(XMLFilterBase):
	scopes = []
	map = dict([(name, [name]) for name in [
			'BOOL', 'BYTE',
			'CARD8', 'CARD16', 'CARD32',
			'INT8', 'INT16', 'INT32',
			'char', 'void',
			'float', 'double',
			'XID',
		]])
	def startScope(self, name):
		self.scopes.insert(0, name)
	def declareType(self, name):
		assert ':' not in name
		qname = self.scopes[0] + ':' + name
		self.map.setdefault(name, []).append(qname)
	def getQualifiedType(self, name):
		if ':' in name:
			return name
		names = self.map.get(name, [])<commit_msg>Bugfix: Make type shadowing go the right way in type.py.<commit_after>#!/usr/bin/python

from xml.sax.saxutils import XMLFilterBase, XMLGenerator
from xml.sax.xmlreader import AttributesImpl
from xml.sax import make_parser
import sys

def AttributesUnion(base, **values):
	baseitems = dict(base)
	baseitems.update(values)
	return AttributesImpl(baseitems)

class AnnotateType(XMLFilterBase):
	scopes = []
	map = dict([(name, [name]) for name in [
			'BOOL', 'BYTE',
			'CARD8', 'CARD16', 'CARD32',
			'INT8', 'INT16', 'INT32',
			'char', 'void',
			'float', 'double',
			'XID',
		]])
	def startScope(self, name):
		self.scopes.insert(0, name)
	def declareType(self, name):
		assert ':' not in name
		qname = self.scopes[0] + ':' + name
		self.map.setdefault(name, []).insert(0, qname)
	def getQualifiedType(self, name):
		if ':' in name:
			return name
		names = self.map.get(name, [])
{'fraction_non_alphanumeric': 0.16009280742459397, 'fraction_numerical': 0.014501160092807424, 'mean_word_length': 4.546623794212219, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 8}, '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': '4457206', 'n_tokens_mistral': 692, 'n_tokens_neox': 640, 'n_words': 156}