<commit_before># -*- coding: utf-8 -*-
import core.command


class item_interaction(core.command.command):
	def _getArgs(self):
		nbArgs = len(self._args)
		self._args.reverse()

		container = None
		containerIndex = 1
		argsNames = ['containerId', 'container', 'name']
		args = {'name': '', 'container': None, 'containerId': None}

		if nbArgs == 0:
			raise exception(code=exception.CODE_NO_ITEM_GIVEN)

		try:
			quantity = int(self._args[nbArgs - 1])
			self._args.pop()
		except ValueError:
			# 4 arguments have been provided, but the quantity is invalid
			if nbArgs == 4:
				raise exception(code=exception.CODE_INVALID_QUANTITY)
			quantity = 1

		while len(self._args) > 0:
			args[argsNames.pop()] = self._args.pop()

		try:
			if args['containerId'] is not None:
				args['containerId'] = int(args['containerId'])
		except ValueError:
			raise exception(code=exception.CODE_INVALID_CONTAINER_INDEX)

		return (quantity, args['name'], args['container'], args['containerId'])


class exception(core.exception.exception):
	CODE_NO_ITEM_GIVEN = 1
	CODE_INVALID_QUANTITY = 2
	CODE_INVALID_CONTAINER_INDEX = 3

	def getCodes(self):
		return (self.CODE_NO_ITEM_GIVEN, self.CODE_INVALID_QUANTITY)<commit_msg>if only a quantity is provided, an error must occur<commit_after># -*- coding: utf-8 -*-
import core.command


class item_interaction(core.command.command):
	def _getArgs(self):
		nbArgs = len(self._args)
		self._args.reverse()

		container = None
		containerIndex = 1
		argsNames = ['containerId', 'container', 'name']
		args = {'name': '', 'container': None, 'containerId': None}

		if nbArgs == 0:
			raise exception(code=exception.CODE_NO_ITEM_GIVEN)

		try:
			quantity = int(self._args[nbArgs - 1])
			self._args.pop()
		except ValueError:
			# 4 arguments have been provided, but the quantity is invalid
			if nbArgs == 4:
				raise exception(code=exception.CODE_INVALID_QUANTITY)
			quantity = 1

		while len(self._args) > 0:
			args[argsNames.pop()] = self._args.pop()

		try:
			if args['containerId'] is not None:
				args['containerId'] = int(args['containerId'])
		except ValueError:
			raise exception(code=exception.CODE_INVALID_CONTAINER_INDEX)

		if args['name'] == '':
			raise exception(code=exception.CODE_NO_ITEM_GIVEN)

		return (quantity, args['name'], args['container'], args['containerId'])


class exception(core.exception.exception):
	CODE_NO_ITEM_GIVEN = 1
	CODE_INVALID_QUANTITY = 2
	CODE_INVALID_CONTAINER_INDEX = 3

	def getCodes(self):
		return (self.CODE_NO_ITEM_GIVEN, self.CODE_INVALID_QUANTITY)
{'fraction_non_alphanumeric': 0.12981904012588513, 'fraction_numerical': 0.00865460267505901, 'mean_word_length': 4.638580931263858, 'pattern_counts': {'":': 0, '<': 3, '<?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': '1764248', 'n_tokens_mistral': 962, 'n_tokens_neox': 840, 'n_words': 192}