<commit_before># MusicPlayer, https://github.com/albertz/music-player
# Copyright (c) 2013, <NAME>, www.az2000.de
# All rights reserved.
# This code is under the 2-clause BSD license, see License.txt in the root directory of this project.

# This is an implementation of the [MPD protocol](http://www.musicpd.org/doc/protocol/).

MpdVersion = "0.17.0"

import utils, time, State
state = State.state

ACK_ERROR_NOT_LIST = 1
ACK_ERROR_ARG = 2
ACK_ERROR_PASSWORD = 3
ACK_ERROR_PERMISSION = 4
ACK_ERROR_UNKNOWN = 5
ACK_ERROR_NO_EXIST = 50
ACK_ERROR_PLAYLIST_MAX = 51
ACK_ERROR_SYSTEM = 52
ACK_ERROR_PLAYLIST_LOAD = 53
ACK_ERROR_UPDATE_ALREADY = 54
ACK_ERROR_PLAYER_SYNC = 55
ACK_ERROR_EXIST = 56

class MpdException(Exception):
	def __init__(self, errNum=ACK_ERROR_SYSTEM, msg=""):
		self.errNum = errNum
		self.msg = msg

class Session:
	def __init__(self, f):
		self.f = f
		self.playlist = None
		self.playlistIdx = 0
		self.baseIdx = 0
		self.Commands = {}
		from types import MethodType
		for fname in dir(self):
			f = getattr(self, fname)
			if not isinstance(f, MethodType): continue
			if fname[:3] != "cmd": continue
			cmdName = fname[3:].lower()
			self.Commands[cmdName] = f

	def cmdCommands(self):
		f = self.f
		f.write("commands\n")
		for cmdName in self.Commands.keys():
			f.write("command: %s\n" % cmdName)
	
	def cmdNotCommands(self):
		pass # nothing
	
	@property
	def _volumeMax(self):
		assert state.__class__.volume.min == 0
		return float(state.__class__.volume.max)

	@property
	def _volume(self):
		return float(state.volume)

	@property
	def volume(self):
		return int((self._volume / self._volumeMax) * 100.0)

	@volume.setter
	def volume(self, v):
		state.volume = (float(v) / 100.0) * self._volumeMax<commit_msg>small fix<commit_after># MusicPlayer, https://github.com/albertz/music-player
# Copyright (c) 2013, <NAME>, www.az2000.de
# All rights reserved.
# This code is under the 2-clause BSD license, see License.txt in the root directory of this project.

# This is an implementation of the [MPD protocol](http://www.musicpd.org/doc/protocol/).

MpdVersion = "0.17.0"

import utils, time, State
state = State.state

ACK_ERROR_NOT_LIST = 1
ACK_ERROR_ARG = 2
ACK_ERROR_PASSWORD = 3
ACK_ERROR_PERMISSION = 4
ACK_ERROR_UNKNOWN = 5
ACK_ERROR_NO_EXIST = 50
ACK_ERROR_PLAYLIST_MAX = 51
ACK_ERROR_SYSTEM = 52
ACK_ERROR_PLAYLIST_LOAD = 53
ACK_ERROR_UPDATE_ALREADY = 54
ACK_ERROR_PLAYER_SYNC = 55
ACK_ERROR_EXIST = 56

class MpdException(Exception):
	def __init__(self, errNum=ACK_ERROR_SYSTEM, msg=""):
		self.errNum = errNum
		self.msg = msg

class Session:
	def __init__(self, f):
		self.f = f
		self.playlist = None
		self.playlistIdx = 0
		self.baseIdx = 0
		self.Commands = {}
		from types import MethodType
		for fname in dir(self):
			f = getattr(self, fname)
			if not isinstance(f, MethodType): continue
			if fname[:3] != "cmd": continue
			cmdName = fname[3:].lower()
			self.Commands[cmdName] = f

	def cmdCommands(self):
		f = self.f
		f.write("commands\n")
		for cmdName in self.Commands.keys():
			f.write("command: %s\n" % cmdName)
	
	def cmdNotCommands(self):
		pass # nothing
	
	@property
	def _volumeMax(self):
		assert state.__class__.volume.type.min == 0
		return float(state.__class__.volume.type.max)

	@property
	def _volume(self):
		return float(state.volume)

	@property
	def volume(self):
		return int((self._volume / self._volumeMax) * 100.0)

	@volume.setter
	def volume(self, v):
		state.volume = (float(v) / 100.0) * self._volumeMax
{'fraction_non_alphanumeric': 0.11818703384968446, 'fraction_numerical': 0.025817555938037865, 'mean_word_length': 4.204477611940298, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 4, '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': '6666328', 'n_tokens_mistral': 1398, 'n_tokens_neox': 1259, 'n_words': 320}