<commit_before>import time
try:
	from h2.exceptions import FlowControlError
except ImportError:
	pass
from rs4 import producers
from rs4 import asynchat

class h2header_producer:
	def __init__ (self, stream_id, headers, producer, encoder, lock):
		# DO NOT set self.stream_id
		# if set, http2_producer_fifo try to re-sort and will raise error
		self.__stream_id = stream_id
		self.__producer = producer # body producer or trailers
		with lock:
			encoder.send_headers (
				stream_id = self.__stream_id,
				headers = headers,
				end_stream = not producer and True or False
			)
			self.data_to_send = encoder.data_to_send ()

	def get_size (self):
		return 0

	def __repr__ (self):
		return "<h2header_producer stream_id:%d end_strem: %s>" % (self.__stream_id, not self.__producer and True or False)

	def more (self):
		data_to_send, self.data_to_send = self.data_to_send, b''
		return data_to_send


class h2frame_producer:
	SIZE_BUFFER = 16384
	MIN_RFCW = 4096
	MIN_IBFCW = 65535
	def __init__ (self, stream_id, depends_on, weight, producer, encoder, lock, trailers = False):
		self.stream_id = stream_id
		self.depends_on = depends_on
		self.weight = weight
		self.producer = producer # globbing_producer<commit_msg>fix __repr__<commit_after>import time
try:
	from h2.exceptions import FlowControlError
except ImportError:
	pass
from rs4 import producers
from rs4 import asynchat

class h2header_producer:
	def __init__ (self, stream_id, headers, producer, encoder, lock):
		# DO NOT set self.stream_id
		# if set, http2_producer_fifo try to re-sort and will raise error
		self.__stream_id = stream_id
		self.__producer = producer # body producer or trailers
		with lock:
			encoder.send_headers (
				stream_id = self.__stream_id,
				headers = headers,
				end_stream = not producer and True or False
			)
			self.data_to_send = encoder.data_to_send ()

	def get_size (self):
		return 0

	def __repr__ (self):
		return "<%s stream_id:%d end_strem: %s>" % (self.__class__.__name__, self.__stream_id, not self.__producer and True or False)

	def more (self):
		data_to_send, self.data_to_send = self.data_to_send, b''
		return data_to_send


class h2frame_producer:
	SIZE_BUFFER = 16384
	MIN_RFCW = 4096
	MIN_IBFCW = 65535
	def __init__ (self, stream_id, depends_on, weight, producer, encoder, lock, trailers = False):
		self.stream_id = stream_id
		self.depends_on = depends_on
		self.weight = weight
		self.producer = producer # globbing_producer
{'fraction_non_alphanumeric': 0.07820773930753565, 'fraction_numerical': 0.017515274949083504, 'mean_word_length': 4.397802197802198, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '3612230', 'n_tokens_mistral': 938, 'n_tokens_neox': 839, 'n_words': 247}