<commit_before>
import itertools
from lmap import ldap

# do a diff between two dicts and output the results as a modlist
def _compmod(new, old):
	modlist = []
	for k in new.keys():
		if k not in old:
			#print('+', k, new[k])
			modlist.append((ldap.ldapmod.ADD, k, new[k]))
		elif new[k] != old[k]:
			#print('=', k, new[k])
			modlist.append((ldap.ldapmod.REPLACE, k, new[k]))
	for k in old.keys():
		if k not in new:
			#print('-', k)
			modlist.append((ldap.ldapmod.DELETE, k, None))
	return modlist

class lmap(dict):
#Object infrastructure
	def __init__(self, attrs={}, dn='', ldap=None, timeout=-1):
		self._ldap = ldap
		self.timeout = timeout
		self.dn = dn
		self._rollback_state = {}
		if attrs:
			self.attrs = attrs
	
#Transaction handling
	def __enter__(self):
		self.start_transaction()
<commit_msg>Fixed the context handler __enter__ return value<commit_after>
import itertools
from lmap import ldap

# do a diff between two dicts and output the results as a modlist
def _compmod(new, old):
	modlist = []
	for k in new.keys():
		if k not in old:
			#print('+', k, new[k])
			modlist.append((ldap.ldapmod.ADD, k, new[k]))
		elif new[k] != old[k]:
			#print('=', k, new[k])
			modlist.append((ldap.ldapmod.REPLACE, k, new[k]))
	for k in old.keys():
		if k not in new:
			#print('-', k)
			modlist.append((ldap.ldapmod.DELETE, k, None))
	return modlist

class lmap(dict):
#Object infrastructure
	def __init__(self, attrs={}, dn='', ldap=None, timeout=-1):
		self._ldap = ldap
		self.timeout = timeout
		self.dn = dn
		self._rollback_state = {}
		if attrs:
			self.attrs = attrs
	
#Transaction handling
	def __enter__(self):
		self.start_transaction()
		return self

{'fraction_non_alphanumeric': 0.15008933889219775, 'fraction_numerical': 0.0011911852293031567, 'mean_word_length': 3.84149855907781, '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': '1008840', 'n_tokens_mistral': 680, 'n_tokens_neox': 638, 'n_words': 188}