






'''simple docstring'''







import json
import os
import shutil
import tempfile
import unittest

from transformers import BatchEncoding, CanineTokenizer
from transformers.testing_utils import require_tokenizers, require_torch
from transformers.tokenization_utils import AddedToken
from transformers.utils import cached_property

from ...test_tokenization_common import TokenizerTesterMixin

class _lowercase     (    _lowercase    ,				unittest.TestCase		):
							a    				=	CanineTokenizer
							a    				=	False




							def 		lowerCamelCase_    (							self:    Optional[Any]					):
														super().setUp()
														lowerCamelCase__ :     Dict	  =	CanineTokenizer()
														tokenizer.save_pretrained(self.tmpdirname					)




							@cached_property
							def 		lowerCamelCase_    (							self:    Dict					):
														return CanineTokenizer.from_pretrained("""google/canine-s"""					)




							def 		lowerCamelCase_    (							self:    str      ,							**UpperCamelCase__:    str					):
														lowerCamelCase__ :     str	  =	self.tokenizer_class.from_pretrained(self.tmpdirname      ,							**UpperCamelCase__					)
														lowerCamelCase__ :     Dict	  =	1_024
														return tokenizer




							@require_torch
							def 		lowerCamelCase_    (							self:    Tuple					):
														lowerCamelCase__ :     List[str]	  =	self.canine_tokenizer
														lowerCamelCase__ :     Tuple	  =	["""Life is like a box of chocolates.""", """You never know what you're gonna get."""]
														# fmt: off
														lowerCamelCase__ :     Optional[Any]	  =	[57_344, 76, 105, 102, 101, 32, 105, 115, 32, 108, 105, 107, 101, 32, 97, 32, 98, 111, 120, 32, 111, 102, 32, 99, 104, 111, 99, 111, 108, 97, 116, 101, 115, 46, 57_345, 0, 0, 0, 0]
														# fmt: on
														lowerCamelCase__ :     str	  =	tokenizer(UpperCamelCase__      ,							padding=UpperCamelCase__      ,							return_tensors="""pt"""					)
														self.assertIsInstance(UpperCamelCase__      ,							UpperCamelCase__					)

														lowerCamelCase__ :     str	  =	list(batch.input_ids.numpy()[0]					)

														self.assertListEqual(UpperCamelCase__      ,							UpperCamelCase__					)

														self.assertEqual((2, 39)      ,							batch.input_ids.shape					)
														self.assertEqual((2, 39)      ,							batch.attention_mask.shape					)




							@require_torch
							def 		lowerCamelCase_    (							self:    Optional[Any]					):
														lowerCamelCase__ :     str	  =	self.canine_tokenizer
														lowerCamelCase__ :     int	  =	["""Once there was a man.""", """He wrote a test in HuggingFace Tranformers."""]
														lowerCamelCase__ :     Union[str, Any]	  =	tokenizer(UpperCamelCase__      ,							padding=UpperCamelCase__      ,							return_tensors="""pt"""					)
														# check if input_ids, attention_mask and token_type_ids are returned
														self.assertIn("""input_ids"""      ,							UpperCamelCase__					)
														self.assertIn("""attention_mask"""      ,							UpperCamelCase__					)
														self.assertIn("""token_type_ids"""      ,							UpperCamelCase__					)




							@require_torch
							def 		lowerCamelCase_    (							self:    int					):
														lowerCamelCase__ :     Optional[Any]	  =	self.canine_tokenizer
														lowerCamelCase__ :     List[str]	  =	[
														    """What's the weater?""",
														    """It's about 25 degrees.""",
														]
														lowerCamelCase__ :     str	  =	tokenizer(
														    text_target=UpperCamelCase__      ,							max_length=32      ,							padding="""max_length"""      ,							truncation=UpperCamelCase__      ,							return_tensors="""pt"""					)
														self.assertEqual(32      ,							targets["""input_ids"""].shape[1]					)




							def 		lowerCamelCase_    (							self:    Optional[Any]					):
														# safety check on max_len default value so we are sure the test works
														lowerCamelCase__ :     Dict	  =	self.get_tokenizers()
														for tokenizer in tokenizers:
																					with self.subTest(F'''{tokenizer.__class__.__name__}'''					):
																												self.assertNotEqual(tokenizer.model_max_length      ,							42					)

        # Now let's start the test
														lowerCamelCase__ :     Optional[int]	  =	self.get_tokenizers()
														for tokenizer in tokenizers:
																					with self.subTest(F'''{tokenizer.__class__.__name__}'''					):
																												# Isolate this from the other tests because we save additional tokens/etc
																												lowerCamelCase__ :     str	  =	tempfile.mkdtemp()

																												lowerCamelCase__ :     Union[str, Any]	  =	""" He is very happy, UNwant\u00E9d,running"""
																												lowerCamelCase__ :     Optional[int]	  =	tokenizer.encode(UpperCamelCase__      ,							add_special_tokens=UpperCamelCase__					)
																												tokenizer.save_pretrained(UpperCamelCase__					)

																												lowerCamelCase__ :     Optional[int]	  =	tokenizer.__class__.from_pretrained(UpperCamelCase__					)
																												lowerCamelCase__ :     List[Any]	  =	after_tokenizer.encode(UpperCamelCase__      ,							add_special_tokens=UpperCamelCase__					)
																												self.assertListEqual(UpperCamelCase__      ,							UpperCamelCase__					)

																												shutil.rmtree(UpperCamelCase__					)

														lowerCamelCase__ :     Tuple	  =	self.get_tokenizers(model_max_length=42					)
														for tokenizer in tokenizers:
																					with self.subTest(F'''{tokenizer.__class__.__name__}'''					):
																												# Isolate this from the other tests because we save additional tokens/etc
																												lowerCamelCase__ :     Any	  =	tempfile.mkdtemp()

																												lowerCamelCase__ :     str	  =	""" He is very happy, UNwant\u00E9d,running"""

																												lowerCamelCase__ :     str	  =	tokenizer.additional_special_tokens

																												# We can add a new special token for Canine as follows:
																												lowerCamelCase__ :     int	  =	chr(0xE007					)
																												additional_special_tokens.append(UpperCamelCase__					)
																												tokenizer.add_special_tokens({"""additional_special_tokens""": additional_special_tokens}					)
																												lowerCamelCase__ :     List[Any]	  =	tokenizer.encode(UpperCamelCase__      ,							add_special_tokens=UpperCamelCase__					)
																												tokenizer.save_pretrained(UpperCamelCase__					)

																												lowerCamelCase__ :     Tuple	  =	tokenizer.__class__.from_pretrained(UpperCamelCase__					)
																												lowerCamelCase__ :     int	  =	after_tokenizer.encode(UpperCamelCase__      ,							add_special_tokens=UpperCamelCase__					)
																												self.assertListEqual(UpperCamelCase__      ,							UpperCamelCase__					)
																												self.assertIn(UpperCamelCase__      ,							after_tokenizer.additional_special_tokens					)
																												self.assertEqual(after_tokenizer.model_max_length      ,							42					)

																												lowerCamelCase__ :     Optional[int]	  =	tokenizer.__class__.from_pretrained(UpperCamelCase__      ,							model_max_length=43					)
																												self.assertEqual(tokenizer.model_max_length      ,							43					)

																												shutil.rmtree(UpperCamelCase__					)




							def 		lowerCamelCase_    (							self:    Tuple					):
														lowerCamelCase__ :     Dict	  =	self.get_tokenizers(do_lower_case=UpperCamelCase__					)
														for tokenizer in tokenizers:
																					with self.subTest(F'''{tokenizer.__class__.__name__}'''					):
																												lowerCamelCase__  ,		lowerCamelCase__ :     Tuple	  =	self.get_clean_sequence(UpperCamelCase__					)

																												# a special token for Canine can be defined as follows:
																												lowerCamelCase__ :     Tuple	  =	0xE005
																												lowerCamelCase__ :     Optional[Any]	  =	chr(UpperCamelCase__					)

																												tokenizer.add_special_tokens({"""cls_token""": special_token}					)
																												lowerCamelCase__ :     List[str]	  =	tokenizer.encode(UpperCamelCase__      ,							add_special_tokens=UpperCamelCase__					)
																												self.assertEqual(len(UpperCamelCase__					)      ,							1					)

																												lowerCamelCase__ :     Optional[int]	  =	tokenizer.decode(ids + encoded_special_token      ,							clean_up_tokenization_spaces=UpperCamelCase__					)
																												lowerCamelCase__ :     str	  =	tokenizer.encode(UpperCamelCase__      ,							add_special_tokens=UpperCamelCase__					)

																												lowerCamelCase__ :     List[str]	  =	tokenizer.encode(UpperCamelCase__      ,							add_special_tokens=UpperCamelCase__					)
																												lowerCamelCase__ :     int	  =	tokenizer.encode(UpperCamelCase__      ,							add_special_tokens=UpperCamelCase__					)
																												self.assertEqual(UpperCamelCase__      ,							input_encoded + special_token_id					)

																												lowerCamelCase__ :     Dict	  =	tokenizer.decode(UpperCamelCase__      ,							skip_special_tokens=UpperCamelCase__					)
																												self.assertTrue(special_token not in decoded					)




							def 		lowerCamelCase_    (							self:    Union[str, Any]					):
														lowerCamelCase__ :     str	  =	self.get_tokenizers(do_lower_case=UpperCamelCase__					)
														for tokenizer in tokenizers:
																					with self.subTest(F'''{tokenizer.__class__.__name__}'''					):
																												lowerCamelCase__ :     Any	  =	chr(0xE005					)
																												lowerCamelCase__ :     Tuple	  =	chr(0xE006					)

																												# `add_tokens` method stores special tokens only in `tokenizer.unique_no_split_tokens`. (in tokenization_utils.py)
																												tokenizer.add_tokens([SPECIAL_TOKEN_1]      ,							special_tokens=UpperCamelCase__					)
																												# `add_special_tokens` method stores special tokens in `tokenizer.additional_special_tokens`,
																												# which also occur in `tokenizer.all_special_tokens`. (in tokenization_utils_base.py)
																												tokenizer.add_special_tokens({"""additional_special_tokens""": [SPECIAL_TOKEN_2]}					)

																												lowerCamelCase__ :     int	  =	tokenizer.tokenize(UpperCamelCase__					)
																												lowerCamelCase__ :     int	  =	tokenizer.tokenize(UpperCamelCase__					)

																												self.assertEqual(len(UpperCamelCase__					)      ,							1					)
																												self.assertEqual(len(UpperCamelCase__					)      ,							1					)
																												self.assertEqual(token_a[0]      ,							UpperCamelCase__					)
																												self.assertEqual(token_a[0]      ,							UpperCamelCase__					)




							@require_tokenizers
							def 		lowerCamelCase_    (							self:    Union[str, Any]					):
														lowerCamelCase__ :     Dict	  =	self.get_tokenizers(do_lower_case=UpperCamelCase__					)
														for tokenizer in tokenizers:
																					with self.subTest(F'''{tokenizer.__class__.__name__}'''					):
																												# a special token for Canine can be defined as follows:
																												lowerCamelCase__ :     Tuple	  =	0xE006
																												lowerCamelCase__ :     Any	  =	chr(UpperCamelCase__					)

																												lowerCamelCase__ :     Dict	  =	AddedToken(UpperCamelCase__      ,							lstrip=UpperCamelCase__					)
																												tokenizer.add_special_tokens({"""additional_special_tokens""": [new_token]}					)

																												with tempfile.TemporaryDirectory() as tmp_dir_name:
																																			tokenizer.save_pretrained(UpperCamelCase__					)
																																			tokenizer.from_pretrained(UpperCamelCase__					)




							def 		lowerCamelCase_    (							self:    Dict					):
														lowerCamelCase__ :     Union[str, Any]	  =	[]
														if self.test_slow_tokenizer:
																					tokenizer_list.append((self.tokenizer_class, self.get_tokenizer())					)

														if self.test_rust_tokenizer:
																					tokenizer_list.append((self.rust_tokenizer_class, self.get_rust_tokenizer())					)

														for tokenizer_class, tokenizer_utils in tokenizer_list:
																					with tempfile.TemporaryDirectory() as tmp_dir:
																												tokenizer_utils.save_pretrained(UpperCamelCase__					)

																												with open(os.path.join(UpperCamelCase__      ,							"""special_tokens_map.json"""					)      ,							encoding="""utf-8"""					) as json_file:
																																			lowerCamelCase__ :     Dict	  =	json.load(UpperCamelCase__					)

																												with open(os.path.join(UpperCamelCase__      ,							"""tokenizer_config.json"""					)      ,							encoding="""utf-8"""					) as json_file:
																																			lowerCamelCase__ :     Optional[int]	  =	json.load(UpperCamelCase__					)

																												# a special token for Canine can be defined as follows:
																												lowerCamelCase__ :     Union[str, Any]	  =	0xE006
																												lowerCamelCase__ :     Optional[int]	  =	chr(UpperCamelCase__					)

																												lowerCamelCase__ :     int	  =	[new_token_a]
																												lowerCamelCase__ :     Any	  =	[new_token_a]

																												with open(os.path.join(UpperCamelCase__      ,							"""special_tokens_map.json"""					)      ,							"""w"""      ,							encoding="""utf-8"""					) as outfile:
																																			json.dump(UpperCamelCase__      ,							UpperCamelCase__					)
																												with open(os.path.join(UpperCamelCase__      ,							"""tokenizer_config.json"""					)      ,							"""w"""      ,							encoding="""utf-8"""					) as outfile:
																																			json.dump(UpperCamelCase__      ,							UpperCamelCase__					)

																												# the following checks allow us to verify that our test works as expected, i.e. that the tokenizer takes
																												# into account the new value of additional_special_tokens given in the "tokenizer_config.json" and
																												# "special_tokens_map.json" files
																												lowerCamelCase__ :     str	  =	tokenizer_class.from_pretrained(UpperCamelCase__      ,							extra_ids=0					)
																												self.assertIn(UpperCamelCase__      ,							tokenizer_without_change_in_init.additional_special_tokens					)
																												# self.assertIn("an_additional_special_token",tokenizer_without_change_in_init.get_vocab()) # ByT5Tokenization no vocab
																												self.assertEqual(
																												    [new_token_a]      ,							tokenizer_without_change_in_init.convert_ids_to_tokens(
																												        tokenizer_without_change_in_init.convert_tokens_to_ids([new_token_a]					)					)      ,							)

																												lowerCamelCase__ :     List[Any]	  =	0xE007
																												lowerCamelCase__ :     Optional[int]	  =	chr(UpperCamelCase__					)
																												# Now we test that we can change the value of additional_special_tokens in the from_pretrained
																												lowerCamelCase__ :     Optional[int]	  =	[AddedToken(UpperCamelCase__      ,							lstrip=UpperCamelCase__					)]
																												lowerCamelCase__ :     str	  =	tokenizer_class.from_pretrained(
																												    UpperCamelCase__      ,							additional_special_tokens=UpperCamelCase__      ,							extra_ids=0					)

																												self.assertIn(UpperCamelCase__      ,							tokenizer.additional_special_tokens					)
																												# self.assertIn(new_token_2,tokenizer.get_vocab()) # ByT5Tokenization no vocab
																												self.assertEqual(
																												    [new_token_a]      ,							tokenizer.convert_ids_to_tokens(tokenizer.convert_tokens_to_ids([new_token_a]					)					)					)




							@require_tokenizers
							def 		lowerCamelCase_    (							self:    Any					):
														lowerCamelCase__ :     Optional[int]	  =	self.get_tokenizers(do_lower_case=UpperCamelCase__					)
														for tokenizer in tokenizers:
																					with self.subTest(F'''{tokenizer.__class__.__name__}'''					):
																												lowerCamelCase__ :     Tuple	  =	"""hello world"""
																												if self.space_between_special_tokens:
																																			lowerCamelCase__ :     str	  =	"""[CLS] hello world [SEP]"""
																												else:
																																			lowerCamelCase__ :     str	  =	input
																												lowerCamelCase__ :     Optional[Any]	  =	tokenizer.encode(UpperCamelCase__      ,							add_special_tokens=UpperCamelCase__					)
																												lowerCamelCase__ :     List[Any]	  =	tokenizer.decode(UpperCamelCase__      ,							spaces_between_special_tokens=self.space_between_special_tokens					)
																												self.assertIn(UpperCamelCase__      ,							[output, output.lower()]					)




							def 		lowerCamelCase_    (							self:    Optional[Any]					):
														lowerCamelCase__ :     List[Any]	  =	self.get_tokenizers()
														for tokenizer in tokenizers:
																					with self.subTest(F'''{tokenizer.__class__.__name__}'''					):
																												lowerCamelCase__ :     List[Any]	  =	[
																												    """bos_token""",
																												    """eos_token""",
																												    """unk_token""",
																												    """sep_token""",
																												    """pad_token""",
																												    """cls_token""",
																												    """mask_token""",
																												]

														lowerCamelCase__ :     List[Any]	  =	"""a"""
														lowerCamelCase__ :     Tuple	  =	ord(UpperCamelCase__					)

														for attr in attributes_list:
																					setattr(UpperCamelCase__      ,							attr + """_id"""      ,							UpperCamelCase__					)
																					self.assertEqual(getattr(UpperCamelCase__      ,							UpperCamelCase__					)      ,							UpperCamelCase__					)
																					self.assertEqual(getattr(UpperCamelCase__      ,							attr + """_id"""					)      ,							UpperCamelCase__					)

																					setattr(UpperCamelCase__      ,							attr + """_id"""      ,							UpperCamelCase__					)
																					self.assertEqual(getattr(UpperCamelCase__      ,							UpperCamelCase__					)      ,							UpperCamelCase__					)
																					self.assertEqual(getattr(UpperCamelCase__      ,							attr + """_id"""					)      ,							UpperCamelCase__					)

														setattr(UpperCamelCase__      ,							"""additional_special_tokens_ids"""      ,							[]					)
														self.assertListEqual(getattr(UpperCamelCase__      ,							"""additional_special_tokens"""					)      ,							[]					)
														self.assertListEqual(getattr(UpperCamelCase__      ,							"""additional_special_tokens_ids"""					)      ,							[]					)

														lowerCamelCase__ :     int	  =	0xE006
														lowerCamelCase__ :     Optional[int]	  =	chr(UpperCamelCase__					)
														setattr(UpperCamelCase__      ,							"""additional_special_tokens_ids"""      ,							[additional_special_token_id]					)
														self.assertListEqual(getattr(UpperCamelCase__      ,							"""additional_special_tokens"""					)      ,							[additional_special_token]					)
														self.assertListEqual(getattr(UpperCamelCase__      ,							"""additional_special_tokens_ids"""					)      ,							[additional_special_token_id]					)




							def 		lowerCamelCase_    (							self:    Union[str, Any]					):
														pass




							def 		lowerCamelCase_    (							self:    Tuple					):
														pass




							def 		lowerCamelCase_    (							self:    str					):
														pass




							def 		lowerCamelCase_    (							self:    Optional[int]					):
														pass




							def 		lowerCamelCase_    (							self:    int					):
														pass




							def 		lowerCamelCase_    (							self:    int					):
														pass




							def 		lowerCamelCase_    (							self:    List[Any]					):
														pass




							def 		lowerCamelCase_    (							self:    Optional[Any]					):
														pass









'''simple docstring'''







from collections import deque

class _lowercase     :




							def __init__(							self:    int      ,							UpperCamelCase__:    str      ,							UpperCamelCase__:    int      ,							UpperCamelCase__:    int					):
														lowerCamelCase__ :     int	  =	process_name  # process name
														lowerCamelCase__ :     int	  =	arrival_time  # arrival time of the process
														# completion time of finished process or last interrupted time
														lowerCamelCase__ :     List[str]	  =	arrival_time
														lowerCamelCase__ :     Tuple	  =	burst_time  # remaining burst time
														lowerCamelCase__ :     str	  =	0  # total time of the process wait in ready queue
														lowerCamelCase__ :     Optional[Any]	  =	0  # time from arrival time to completion time



class _lowercase     :




							def __init__(							self:    Any      ,							UpperCamelCase__:    int      ,							UpperCamelCase__:    list[int]      ,							UpperCamelCase__:    deque[Process]      ,							UpperCamelCase__:    int      ,							):
														# total number of mlfq's queues
														lowerCamelCase__ :     Tuple	  =	number_of_queues
														# time slice of queues that round robin algorithm applied
														lowerCamelCase__ :     List[Any]	  =	time_slices
														# unfinished process is in this ready_queue
														lowerCamelCase__ :     int	  =	queue
														# current time
														lowerCamelCase__ :     Optional[int]	  =	current_time
														# finished process is in this sequence queue
														lowerCamelCase__ :     deque[Process]	  =	deque()




							def 		lowerCamelCase_    (							self:    Union[str, Any]					):
														lowerCamelCase__ :     Union[str, Any]	  =	[]
														for i in range(len(self.finish_queue					)					):
																					sequence.append(self.finish_queue[i].process_name					)
														return sequence




							def 		lowerCamelCase_    (							self:    Union[str, Any]      ,							UpperCamelCase__:    list[Process]					):
														lowerCamelCase__ :     int	  =	[]
														for i in range(len(UpperCamelCase__					)					):
																					waiting_times.append(queue[i].waiting_time					)
														return waiting_times




							def 		lowerCamelCase_    (							self:    Any      ,							UpperCamelCase__:    list[Process]					):
														lowerCamelCase__ :     Optional[int]	  =	[]
														for i in range(len(UpperCamelCase__					)					):
																					turnaround_times.append(queue[i].turnaround_time					)
														return turnaround_times




							def 		lowerCamelCase_    (							self:    Union[str, Any]      ,							UpperCamelCase__:    list[Process]					):
														lowerCamelCase__ :     List[Any]	  =	[]
														for i in range(len(UpperCamelCase__					)					):
																					completion_times.append(queue[i].stop_time					)
														return completion_times




							def 		lowerCamelCase_    (							self:    int      ,							UpperCamelCase__:    deque[Process]					):
														return [q.burst_time for q in queue]




							def 		lowerCamelCase_    (							self:    List[str]      ,							UpperCamelCase__:    Process					):
														process.waiting_time += self.current_time - process.stop_time
														return process.waiting_time




							def 		lowerCamelCase_    (							self:    Optional[Any]      ,							UpperCamelCase__:    deque[Process]					):
														lowerCamelCase__ :     deque[Process]	  =	deque()  # sequence deque of finished process
														while len(UpperCamelCase__					) != 0:
																					lowerCamelCase__ :     List[Any]	  =	ready_queue.popleft()  # current process

																					# if process's arrival time is later than current time, update current time
																					if self.current_time < cp.arrival_time:
																												self.current_time += cp.arrival_time

																					# update waiting time of current process
																					self.update_waiting_time(UpperCamelCase__					)
																					# update current time
																					self.current_time += cp.burst_time
																					# finish the process and set the process's burst-time 0
																					lowerCamelCase__ :     Dict	  =	0
																					# set the process's turnaround time because it is finished
																					lowerCamelCase__ :     List[str]	  =	self.current_time - cp.arrival_time
																					# set the completion time
																					lowerCamelCase__ :     int	  =	self.current_time
																					# add the process to queue that has finished queue
																					finished.append(UpperCamelCase__					)

														self.finish_queue.extend(UpperCamelCase__					)  # add finished process to finish queue
														# FCFS will finish all remaining processes
														return finished




							def 		lowerCamelCase_    (							self:    Union[str, Any]      ,							UpperCamelCase__:    deque[Process]      ,							UpperCamelCase__:    int					):
														lowerCamelCase__ :     deque[Process]	  =	deque()  # sequence deque of terminated process
														# just for 1 cycle and unfinished processes will go back to queue
														for _ in range(len(UpperCamelCase__					)					):
																					lowerCamelCase__ :     Optional[int]	  =	ready_queue.popleft()  # current process

																					# if process's arrival time is later than current time, update current time
																					if self.current_time < cp.arrival_time:
																												self.current_time += cp.arrival_time

																					# update waiting time of unfinished processes
																					self.update_waiting_time(UpperCamelCase__					)
																					# if the burst time of process is bigger than time-slice
																					if cp.burst_time > time_slice:
																												# use CPU for only time-slice
																												self.current_time += time_slice
																												# update remaining burst time
																												cp.burst_time -= time_slice
																												# update end point time
																												lowerCamelCase__ :     Dict	  =	self.current_time
																												# locate the process behind the queue because it is not finished
																												ready_queue.append(UpperCamelCase__					)
																					else:
																												# use CPU for remaining burst time
																												self.current_time += cp.burst_time
																												# set burst time 0 because the process is finished
																												lowerCamelCase__ :     Any	  =	0
																												# set the finish time
																												lowerCamelCase__ :     List[Any]	  =	self.current_time
																												# update the process' turnaround time because it is finished
																												lowerCamelCase__ :     Any	  =	self.current_time - cp.arrival_time
																												# add the process to queue that has finished queue
																												finished.append(UpperCamelCase__					)

														self.finish_queue.extend(UpperCamelCase__					)  # add finished process to finish queue
														# return finished processes queue and remaining processes queue
														return finished, ready_queue




							def 		lowerCamelCase_    (							self:    Tuple					):

														#  all queues except last one have round_robin algorithm
														for i in range(self.number_of_queues - 1					):
																					lowerCamelCase__  ,		lowerCamelCase__ :     str	  =	self.round_robin(
																					    self.ready_queue      ,							self.time_slices[i]					)
														#  the last queue has first_come_first_served algorithm
														self.first_come_first_served(self.ready_queue					)

														return self.finish_queue


if __name__ == "__main__":
			import doctest

			_A     :      Optional[Any]   					=Process('''P1''', 0, 53)
			_A     :      List[Any]   					=Process('''P2''', 0, 17)
			_A     :      Any   					=Process('''P3''', 0, 68)
			_A     :      Tuple   					=Process('''P4''', 0, 24)
			_A     :      int   					=3
			_A     :      Tuple   					=[17, 25]
			_A     :      List[Any]   					=deque([Pa, Pa, Pa, Pa])

			if len(time_slices) != number_of_queues - 1:
						raise SystemExit(0)

			doctest.testmod(extraglobs={'''queue''': deque([Pa, Pa, Pa, Pa])})

			_A     :      Dict   					=Process('''P1''', 0, 53)
			_A     :      Union[str, Any]   					=Process('''P2''', 0, 17)
			_A     :      int   					=Process('''P3''', 0, 68)
			_A     :      Dict   					=Process('''P4''', 0, 24)
			_A     :      List[str]   					=3
			_A     :      List[Any]   					=[17, 25]
			_A     :      Any   					=deque([Pa, Pa, Pa, Pa])
			_A     :      List[str]   					=MLFQ(number_of_queues, time_slices, queue, 0)
			_A     :      Union[str, Any]   					=mlfq.multi_level_feedback_queue()

			# print total waiting times of processes(P1, P2, P3, P4)
			print(
			    F'waiting time:\
        \t\t\t{MLFQ.calculate_waiting_time(mlfq, [Pa, Pa, Pa, Pa])}'
			)
			# print completion times of processes(P1, P2, P3, P4)
			print(
			    F'completion time:\
        \t\t{MLFQ.calculate_completion_time(mlfq, [Pa, Pa, Pa, Pa])}'
			)
			# print total turnaround times of processes(P1, P2, P3, P4)
			print(
			    F'turnaround time:\
        \t\t{MLFQ.calculate_turnaround_time(mlfq, [Pa, Pa, Pa, Pa])}'
			)
			# print sequence of finished processes
			print(
			    F'sequence of finished processes:\
        {mlfq.calculate_sequence_of_finish_queue()}'
			)

