<commit_before>import os
import fcntl
import errno
import logging
import socket


class fileobj_wrap:
	"""Helper class provides read/write interface for socket object

	Current helper class wrap recv/send socket methods in read/write interface.
	This functionality needed to workaround some problems of socket.makefile
	method for sockets constructed from numerical file descriptors passed
	through command line arguments.
	"""

	def __init__(self, sk):
		self.__sk = sk

	def read(self, size=0x10000):
		return self.__sk.recv(size)

	def write(self, str):
		self.__sk.send(str)


def discard_sk_input(sk):
	"""Read all data from socket and discard it

	Current helper function needed to workaround tarfile library bug that
	leads to ownerless garbage zero blocks in socket when tarfile constructed
	with socket as file object to transfer tarballs over network.
	"""
	try:
		while True:
			sk.recv(0x10000, socket.MSG_DONTWAIT)
	except socket.error as e:
		if e.errno != errno.EWOULDBLOCK:
			raise e


class net_dev:
	def __init__(self, name=None, pair=None, link=None):
		self.name = name
		self.pair = pair
		self.link = link


def path_to_fs(path):
	dev = os.stat(path)
	dev_str = "%d:%d" % (os.major(dev.st_dev), os.minor(dev.st_dev))
	mfd = open("/proc/self/mountinfo")
	for ln in mfd:
		ln_p = ln.split(None, 9)
		if dev_str == ln_p[2]:
			return ln_p[8]

	return None


def ifup(ifname):<commit_msg>p.haul: remove unused util.path_to_fs function<commit_after>import os
import fcntl
import errno
import logging
import socket


class fileobj_wrap:
	"""Helper class provides read/write interface for socket object

	Current helper class wrap recv/send socket methods in read/write interface.
	This functionality needed to workaround some problems of socket.makefile
	method for sockets constructed from numerical file descriptors passed
	through command line arguments.
	"""

	def __init__(self, sk):
		self.__sk = sk

	def read(self, size=0x10000):
		return self.__sk.recv(size)

	def write(self, str):
		self.__sk.send(str)


def discard_sk_input(sk):
	"""Read all data from socket and discard it

	Current helper function needed to workaround tarfile library bug that
	leads to ownerless garbage zero blocks in socket when tarfile constructed
	with socket as file object to transfer tarballs over network.
	"""
	try:
		while True:
			sk.recv(0x10000, socket.MSG_DONTWAIT)
	except socket.error as e:
		if e.errno != errno.EWOULDBLOCK:
			raise e


class net_dev:
	def __init__(self, name=None, pair=None, link=None):
		self.name = name
		self.pair = pair
		self.link = link


def ifup(ifname):
{'fraction_non_alphanumeric': 0.08192307692307692, 'fraction_numerical': 0.010384615384615384, 'mean_word_length': 4.319018404907975, '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': '2429541', 'n_tokens_mistral': 895, 'n_tokens_neox': 801, 'n_words': 299}