task_id
stringclasses
100 values
skeleton
stringclasses
100 values
test
stringclasses
100 values
solution_code
stringclasses
100 values
import_statement
listlengths
0
4
class_description
stringclasses
100 values
methods_info
listlengths
2
10
class_name
stringclasses
100 values
test_classes
listlengths
2
11
class_constructor
stringclasses
100 values
fields
listlengths
0
9
new_task_id
stringlengths
14
16
line_index
int64
0
75
method_name
stringclasses
379 values
method_signature
stringclasses
405 values
prefix
stringlengths
64
3.88k
solution
stringlengths
9
140
suffix
stringlengths
0
3.61k
ClassEval_16
class Calculator: """ This is a class for a calculator, capable of performing basic arithmetic calculations on numerical expressions using the operators +, -, *, /, and ^ (exponentiation). """ def __init__(self): """ Initialize the operations performed by the five operators'+','-','*','...
import unittest class CalculatorTestCalculate(unittest.TestCase): def test_calculate_1(self): calculator = Calculator() res = calculator.calculate('1+2') self.assertEqual(res, 3) def test_calculate_2(self): calculator = Calculator() res = calculator.calculate('1+2*3') ...
class Calculator: def __init__(self): self.operators = { '+': lambda x, y: x + y, '-': lambda x, y: x - y, '*': lambda x, y: x * y, '/': lambda x, y: x / y, '^': lambda x, y: x ** y } def calculate(self, expression): operand_st...
[]
""" This is a class for a calculator, capable of performing basic arithmetic calculations on numerical expressions using the operators +, -, *, /, and ^ (exponentiation). """
[ { "dependencies": { "Standalone": false, "field_dependencies": [], "lib_dependencies": [], "method_dependencies": [ "precedence", "apply_operator" ] }, "method_description": "def calculate(self, expression):\n \"\"\"\n Calculate the value of a ...
Calculator
[ "CalculatorTestCalculate", "CalculatorTestPrecedence", "CalculatorTestApplyOperator", "CalculatorTest" ]
class Calculator: def __init__(self): """ Initialize the operations performed by the five operators'+','-','*','/','^' """ self.operators = { '+': lambda x, y: x + y, '-': lambda x, y: x - y, '*': lambda x, y: x * y, '/': lambda x, y: ...
[ "self.operators" ]
ClassEval_16_t37
37
apply_operator
def apply_operator(self, operand_stack, operator_stack):
class Calculator: def __init__(self): self.operators = { '+': lambda x, y: x + y, '-': lambda x, y: x - y, '*': lambda x, y: x * y, '/': lambda x, y: x / y, '^': lambda x, y: x ** y } def calculate(self, expression): operand_st...
operator = operator_stack.pop()
if operator == '^': operand2 = operand_stack.pop() operand1 = operand_stack.pop() result = self.operators[operator](operand1, operand2) operand_stack.append(result) else: operand2 = operand_stack.pop() operand1 = operand_stack.pop()...
ClassEval_16
class Calculator: """ This is a class for a calculator, capable of performing basic arithmetic calculations on numerical expressions using the operators +, -, *, /, and ^ (exponentiation). """ def __init__(self): """ Initialize the operations performed by the five operators'+','-','*','...
import unittest class CalculatorTestCalculate(unittest.TestCase): def test_calculate_1(self): calculator = Calculator() res = calculator.calculate('1+2') self.assertEqual(res, 3) def test_calculate_2(self): calculator = Calculator() res = calculator.calculate('1+2*3') ...
class Calculator: def __init__(self): self.operators = { '+': lambda x, y: x + y, '-': lambda x, y: x - y, '*': lambda x, y: x * y, '/': lambda x, y: x / y, '^': lambda x, y: x ** y } def calculate(self, expression): operand_st...
[]
""" This is a class for a calculator, capable of performing basic arithmetic calculations on numerical expressions using the operators +, -, *, /, and ^ (exponentiation). """
[ { "dependencies": { "Standalone": false, "field_dependencies": [], "lib_dependencies": [], "method_dependencies": [ "precedence", "apply_operator" ] }, "method_description": "def calculate(self, expression):\n \"\"\"\n Calculate the value of a ...
Calculator
[ "CalculatorTestCalculate", "CalculatorTestPrecedence", "CalculatorTestApplyOperator", "CalculatorTest" ]
class Calculator: def __init__(self): """ Initialize the operations performed by the five operators'+','-','*','/','^' """ self.operators = { '+': lambda x, y: x + y, '-': lambda x, y: x - y, '*': lambda x, y: x * y, '/': lambda x, y: ...
[ "self.operators" ]
ClassEval_16_t38
38
apply_operator
def apply_operator(self, operand_stack, operator_stack):
class Calculator: def __init__(self): self.operators = { '+': lambda x, y: x + y, '-': lambda x, y: x - y, '*': lambda x, y: x * y, '/': lambda x, y: x / y, '^': lambda x, y: x ** y } def calculate(self, expression): operand_st...
if operator == '^':
operand2 = operand_stack.pop() operand1 = operand_stack.pop() result = self.operators[operator](operand1, operand2) operand_stack.append(result) else: operand2 = operand_stack.pop() operand1 = operand_stack.pop() result = self.o...
ClassEval_16
class Calculator: """ This is a class for a calculator, capable of performing basic arithmetic calculations on numerical expressions using the operators +, -, *, /, and ^ (exponentiation). """ def __init__(self): """ Initialize the operations performed by the five operators'+','-','*','...
import unittest class CalculatorTestCalculate(unittest.TestCase): def test_calculate_1(self): calculator = Calculator() res = calculator.calculate('1+2') self.assertEqual(res, 3) def test_calculate_2(self): calculator = Calculator() res = calculator.calculate('1+2*3') ...
class Calculator: def __init__(self): self.operators = { '+': lambda x, y: x + y, '-': lambda x, y: x - y, '*': lambda x, y: x * y, '/': lambda x, y: x / y, '^': lambda x, y: x ** y } def calculate(self, expression): operand_st...
[]
""" This is a class for a calculator, capable of performing basic arithmetic calculations on numerical expressions using the operators +, -, *, /, and ^ (exponentiation). """
[ { "dependencies": { "Standalone": false, "field_dependencies": [], "lib_dependencies": [], "method_dependencies": [ "precedence", "apply_operator" ] }, "method_description": "def calculate(self, expression):\n \"\"\"\n Calculate the value of a ...
Calculator
[ "CalculatorTestCalculate", "CalculatorTestPrecedence", "CalculatorTestApplyOperator", "CalculatorTest" ]
class Calculator: def __init__(self): """ Initialize the operations performed by the five operators'+','-','*','/','^' """ self.operators = { '+': lambda x, y: x + y, '-': lambda x, y: x - y, '*': lambda x, y: x * y, '/': lambda x, y: ...
[ "self.operators" ]
ClassEval_16_t39
39
apply_operator
def apply_operator(self, operand_stack, operator_stack):
class Calculator: def __init__(self): self.operators = { '+': lambda x, y: x + y, '-': lambda x, y: x - y, '*': lambda x, y: x * y, '/': lambda x, y: x / y, '^': lambda x, y: x ** y } def calculate(self, expression): operand_st...
operand2 = operand_stack.pop()
operand1 = operand_stack.pop() result = self.operators[operator](operand1, operand2) operand_stack.append(result) else: operand2 = operand_stack.pop() operand1 = operand_stack.pop() result = self.operators[operator](operand1, operand2) ...
ClassEval_16
class Calculator: """ This is a class for a calculator, capable of performing basic arithmetic calculations on numerical expressions using the operators +, -, *, /, and ^ (exponentiation). """ def __init__(self): """ Initialize the operations performed by the five operators'+','-','*','...
import unittest class CalculatorTestCalculate(unittest.TestCase): def test_calculate_1(self): calculator = Calculator() res = calculator.calculate('1+2') self.assertEqual(res, 3) def test_calculate_2(self): calculator = Calculator() res = calculator.calculate('1+2*3') ...
class Calculator: def __init__(self): self.operators = { '+': lambda x, y: x + y, '-': lambda x, y: x - y, '*': lambda x, y: x * y, '/': lambda x, y: x / y, '^': lambda x, y: x ** y } def calculate(self, expression): operand_st...
[]
""" This is a class for a calculator, capable of performing basic arithmetic calculations on numerical expressions using the operators +, -, *, /, and ^ (exponentiation). """
[ { "dependencies": { "Standalone": false, "field_dependencies": [], "lib_dependencies": [], "method_dependencies": [ "precedence", "apply_operator" ] }, "method_description": "def calculate(self, expression):\n \"\"\"\n Calculate the value of a ...
Calculator
[ "CalculatorTestCalculate", "CalculatorTestPrecedence", "CalculatorTestApplyOperator", "CalculatorTest" ]
class Calculator: def __init__(self): """ Initialize the operations performed by the five operators'+','-','*','/','^' """ self.operators = { '+': lambda x, y: x + y, '-': lambda x, y: x - y, '*': lambda x, y: x * y, '/': lambda x, y: ...
[ "self.operators" ]
ClassEval_16_t40
40
apply_operator
def apply_operator(self, operand_stack, operator_stack):
class Calculator: def __init__(self): self.operators = { '+': lambda x, y: x + y, '-': lambda x, y: x - y, '*': lambda x, y: x * y, '/': lambda x, y: x / y, '^': lambda x, y: x ** y } def calculate(self, expression): operand_st...
operand1 = operand_stack.pop()
result = self.operators[operator](operand1, operand2) operand_stack.append(result) else: operand2 = operand_stack.pop() operand1 = operand_stack.pop() result = self.operators[operator](operand1, operand2) operand_stack.append(result) ...
ClassEval_16
class Calculator: """ This is a class for a calculator, capable of performing basic arithmetic calculations on numerical expressions using the operators +, -, *, /, and ^ (exponentiation). """ def __init__(self): """ Initialize the operations performed by the five operators'+','-','*','...
import unittest class CalculatorTestCalculate(unittest.TestCase): def test_calculate_1(self): calculator = Calculator() res = calculator.calculate('1+2') self.assertEqual(res, 3) def test_calculate_2(self): calculator = Calculator() res = calculator.calculate('1+2*3') ...
class Calculator: def __init__(self): self.operators = { '+': lambda x, y: x + y, '-': lambda x, y: x - y, '*': lambda x, y: x * y, '/': lambda x, y: x / y, '^': lambda x, y: x ** y } def calculate(self, expression): operand_st...
[]
""" This is a class for a calculator, capable of performing basic arithmetic calculations on numerical expressions using the operators +, -, *, /, and ^ (exponentiation). """
[ { "dependencies": { "Standalone": false, "field_dependencies": [], "lib_dependencies": [], "method_dependencies": [ "precedence", "apply_operator" ] }, "method_description": "def calculate(self, expression):\n \"\"\"\n Calculate the value of a ...
Calculator
[ "CalculatorTestCalculate", "CalculatorTestPrecedence", "CalculatorTestApplyOperator", "CalculatorTest" ]
class Calculator: def __init__(self): """ Initialize the operations performed by the five operators'+','-','*','/','^' """ self.operators = { '+': lambda x, y: x + y, '-': lambda x, y: x - y, '*': lambda x, y: x * y, '/': lambda x, y: ...
[ "self.operators" ]
ClassEval_16_t41
41
apply_operator
def apply_operator(self, operand_stack, operator_stack):
class Calculator: def __init__(self): self.operators = { '+': lambda x, y: x + y, '-': lambda x, y: x - y, '*': lambda x, y: x * y, '/': lambda x, y: x / y, '^': lambda x, y: x ** y } def calculate(self, expression): operand_st...
result = self.operators[operator](operand1, operand2)
operand_stack.append(result) else: operand2 = operand_stack.pop() operand1 = operand_stack.pop() result = self.operators[operator](operand1, operand2) operand_stack.append(result) return operand_stack, operator_stack
ClassEval_16
class Calculator: """ This is a class for a calculator, capable of performing basic arithmetic calculations on numerical expressions using the operators +, -, *, /, and ^ (exponentiation). """ def __init__(self): """ Initialize the operations performed by the five operators'+','-','*','...
import unittest class CalculatorTestCalculate(unittest.TestCase): def test_calculate_1(self): calculator = Calculator() res = calculator.calculate('1+2') self.assertEqual(res, 3) def test_calculate_2(self): calculator = Calculator() res = calculator.calculate('1+2*3') ...
class Calculator: def __init__(self): self.operators = { '+': lambda x, y: x + y, '-': lambda x, y: x - y, '*': lambda x, y: x * y, '/': lambda x, y: x / y, '^': lambda x, y: x ** y } def calculate(self, expression): operand_st...
[]
""" This is a class for a calculator, capable of performing basic arithmetic calculations on numerical expressions using the operators +, -, *, /, and ^ (exponentiation). """
[ { "dependencies": { "Standalone": false, "field_dependencies": [], "lib_dependencies": [], "method_dependencies": [ "precedence", "apply_operator" ] }, "method_description": "def calculate(self, expression):\n \"\"\"\n Calculate the value of a ...
Calculator
[ "CalculatorTestCalculate", "CalculatorTestPrecedence", "CalculatorTestApplyOperator", "CalculatorTest" ]
class Calculator: def __init__(self): """ Initialize the operations performed by the five operators'+','-','*','/','^' """ self.operators = { '+': lambda x, y: x + y, '-': lambda x, y: x - y, '*': lambda x, y: x * y, '/': lambda x, y: ...
[ "self.operators" ]
ClassEval_16_t42
42
apply_operator
def apply_operator(self, operand_stack, operator_stack):
class Calculator: def __init__(self): self.operators = { '+': lambda x, y: x + y, '-': lambda x, y: x - y, '*': lambda x, y: x * y, '/': lambda x, y: x / y, '^': lambda x, y: x ** y } def calculate(self, expression): operand_st...
operand_stack.append(result)
else: operand2 = operand_stack.pop() operand1 = operand_stack.pop() result = self.operators[operator](operand1, operand2) operand_stack.append(result) return operand_stack, operator_stack
ClassEval_16
class Calculator: """ This is a class for a calculator, capable of performing basic arithmetic calculations on numerical expressions using the operators +, -, *, /, and ^ (exponentiation). """ def __init__(self): """ Initialize the operations performed by the five operators'+','-','*','...
import unittest class CalculatorTestCalculate(unittest.TestCase): def test_calculate_1(self): calculator = Calculator() res = calculator.calculate('1+2') self.assertEqual(res, 3) def test_calculate_2(self): calculator = Calculator() res = calculator.calculate('1+2*3') ...
class Calculator: def __init__(self): self.operators = { '+': lambda x, y: x + y, '-': lambda x, y: x - y, '*': lambda x, y: x * y, '/': lambda x, y: x / y, '^': lambda x, y: x ** y } def calculate(self, expression): operand_st...
[]
""" This is a class for a calculator, capable of performing basic arithmetic calculations on numerical expressions using the operators +, -, *, /, and ^ (exponentiation). """
[ { "dependencies": { "Standalone": false, "field_dependencies": [], "lib_dependencies": [], "method_dependencies": [ "precedence", "apply_operator" ] }, "method_description": "def calculate(self, expression):\n \"\"\"\n Calculate the value of a ...
Calculator
[ "CalculatorTestCalculate", "CalculatorTestPrecedence", "CalculatorTestApplyOperator", "CalculatorTest" ]
class Calculator: def __init__(self): """ Initialize the operations performed by the five operators'+','-','*','/','^' """ self.operators = { '+': lambda x, y: x + y, '-': lambda x, y: x - y, '*': lambda x, y: x * y, '/': lambda x, y: ...
[ "self.operators" ]
ClassEval_16_t43
43
apply_operator
def apply_operator(self, operand_stack, operator_stack):
class Calculator: def __init__(self): self.operators = { '+': lambda x, y: x + y, '-': lambda x, y: x - y, '*': lambda x, y: x * y, '/': lambda x, y: x / y, '^': lambda x, y: x ** y } def calculate(self, expression): operand_st...
else:
operand2 = operand_stack.pop() operand1 = operand_stack.pop() result = self.operators[operator](operand1, operand2) operand_stack.append(result) return operand_stack, operator_stack
ClassEval_16
class Calculator: """ This is a class for a calculator, capable of performing basic arithmetic calculations on numerical expressions using the operators +, -, *, /, and ^ (exponentiation). """ def __init__(self): """ Initialize the operations performed by the five operators'+','-','*','...
import unittest class CalculatorTestCalculate(unittest.TestCase): def test_calculate_1(self): calculator = Calculator() res = calculator.calculate('1+2') self.assertEqual(res, 3) def test_calculate_2(self): calculator = Calculator() res = calculator.calculate('1+2*3') ...
class Calculator: def __init__(self): self.operators = { '+': lambda x, y: x + y, '-': lambda x, y: x - y, '*': lambda x, y: x * y, '/': lambda x, y: x / y, '^': lambda x, y: x ** y } def calculate(self, expression): operand_st...
[]
""" This is a class for a calculator, capable of performing basic arithmetic calculations on numerical expressions using the operators +, -, *, /, and ^ (exponentiation). """
[ { "dependencies": { "Standalone": false, "field_dependencies": [], "lib_dependencies": [], "method_dependencies": [ "precedence", "apply_operator" ] }, "method_description": "def calculate(self, expression):\n \"\"\"\n Calculate the value of a ...
Calculator
[ "CalculatorTestCalculate", "CalculatorTestPrecedence", "CalculatorTestApplyOperator", "CalculatorTest" ]
class Calculator: def __init__(self): """ Initialize the operations performed by the five operators'+','-','*','/','^' """ self.operators = { '+': lambda x, y: x + y, '-': lambda x, y: x - y, '*': lambda x, y: x * y, '/': lambda x, y: ...
[ "self.operators" ]
ClassEval_16_t44
44
apply_operator
def apply_operator(self, operand_stack, operator_stack):
class Calculator: def __init__(self): self.operators = { '+': lambda x, y: x + y, '-': lambda x, y: x - y, '*': lambda x, y: x * y, '/': lambda x, y: x / y, '^': lambda x, y: x ** y } def calculate(self, expression): operand_st...
operand2 = operand_stack.pop()
operand1 = operand_stack.pop() result = self.operators[operator](operand1, operand2) operand_stack.append(result) return operand_stack, operator_stack
ClassEval_16
class Calculator: """ This is a class for a calculator, capable of performing basic arithmetic calculations on numerical expressions using the operators +, -, *, /, and ^ (exponentiation). """ def __init__(self): """ Initialize the operations performed by the five operators'+','-','*','...
import unittest class CalculatorTestCalculate(unittest.TestCase): def test_calculate_1(self): calculator = Calculator() res = calculator.calculate('1+2') self.assertEqual(res, 3) def test_calculate_2(self): calculator = Calculator() res = calculator.calculate('1+2*3') ...
class Calculator: def __init__(self): self.operators = { '+': lambda x, y: x + y, '-': lambda x, y: x - y, '*': lambda x, y: x * y, '/': lambda x, y: x / y, '^': lambda x, y: x ** y } def calculate(self, expression): operand_st...
[]
""" This is a class for a calculator, capable of performing basic arithmetic calculations on numerical expressions using the operators +, -, *, /, and ^ (exponentiation). """
[ { "dependencies": { "Standalone": false, "field_dependencies": [], "lib_dependencies": [], "method_dependencies": [ "precedence", "apply_operator" ] }, "method_description": "def calculate(self, expression):\n \"\"\"\n Calculate the value of a ...
Calculator
[ "CalculatorTestCalculate", "CalculatorTestPrecedence", "CalculatorTestApplyOperator", "CalculatorTest" ]
class Calculator: def __init__(self): """ Initialize the operations performed by the five operators'+','-','*','/','^' """ self.operators = { '+': lambda x, y: x + y, '-': lambda x, y: x - y, '*': lambda x, y: x * y, '/': lambda x, y: ...
[ "self.operators" ]
ClassEval_16_t45
45
apply_operator
def apply_operator(self, operand_stack, operator_stack):
class Calculator: def __init__(self): self.operators = { '+': lambda x, y: x + y, '-': lambda x, y: x - y, '*': lambda x, y: x * y, '/': lambda x, y: x / y, '^': lambda x, y: x ** y } def calculate(self, expression): operand_st...
operand1 = operand_stack.pop()
result = self.operators[operator](operand1, operand2) operand_stack.append(result) return operand_stack, operator_stack
ClassEval_16
class Calculator: """ This is a class for a calculator, capable of performing basic arithmetic calculations on numerical expressions using the operators +, -, *, /, and ^ (exponentiation). """ def __init__(self): """ Initialize the operations performed by the five operators'+','-','*','...
import unittest class CalculatorTestCalculate(unittest.TestCase): def test_calculate_1(self): calculator = Calculator() res = calculator.calculate('1+2') self.assertEqual(res, 3) def test_calculate_2(self): calculator = Calculator() res = calculator.calculate('1+2*3') ...
class Calculator: def __init__(self): self.operators = { '+': lambda x, y: x + y, '-': lambda x, y: x - y, '*': lambda x, y: x * y, '/': lambda x, y: x / y, '^': lambda x, y: x ** y } def calculate(self, expression): operand_st...
[]
""" This is a class for a calculator, capable of performing basic arithmetic calculations on numerical expressions using the operators +, -, *, /, and ^ (exponentiation). """
[ { "dependencies": { "Standalone": false, "field_dependencies": [], "lib_dependencies": [], "method_dependencies": [ "precedence", "apply_operator" ] }, "method_description": "def calculate(self, expression):\n \"\"\"\n Calculate the value of a ...
Calculator
[ "CalculatorTestCalculate", "CalculatorTestPrecedence", "CalculatorTestApplyOperator", "CalculatorTest" ]
class Calculator: def __init__(self): """ Initialize the operations performed by the five operators'+','-','*','/','^' """ self.operators = { '+': lambda x, y: x + y, '-': lambda x, y: x - y, '*': lambda x, y: x * y, '/': lambda x, y: ...
[ "self.operators" ]
ClassEval_16_t46
46
apply_operator
def apply_operator(self, operand_stack, operator_stack):
class Calculator: def __init__(self): self.operators = { '+': lambda x, y: x + y, '-': lambda x, y: x - y, '*': lambda x, y: x * y, '/': lambda x, y: x / y, '^': lambda x, y: x ** y } def calculate(self, expression): operand_st...
result = self.operators[operator](operand1, operand2)
operand_stack.append(result) return operand_stack, operator_stack
ClassEval_16
class Calculator: """ This is a class for a calculator, capable of performing basic arithmetic calculations on numerical expressions using the operators +, -, *, /, and ^ (exponentiation). """ def __init__(self): """ Initialize the operations performed by the five operators'+','-','*','...
import unittest class CalculatorTestCalculate(unittest.TestCase): def test_calculate_1(self): calculator = Calculator() res = calculator.calculate('1+2') self.assertEqual(res, 3) def test_calculate_2(self): calculator = Calculator() res = calculator.calculate('1+2*3') ...
class Calculator: def __init__(self): self.operators = { '+': lambda x, y: x + y, '-': lambda x, y: x - y, '*': lambda x, y: x * y, '/': lambda x, y: x / y, '^': lambda x, y: x ** y } def calculate(self, expression): operand_st...
[]
""" This is a class for a calculator, capable of performing basic arithmetic calculations on numerical expressions using the operators +, -, *, /, and ^ (exponentiation). """
[ { "dependencies": { "Standalone": false, "field_dependencies": [], "lib_dependencies": [], "method_dependencies": [ "precedence", "apply_operator" ] }, "method_description": "def calculate(self, expression):\n \"\"\"\n Calculate the value of a ...
Calculator
[ "CalculatorTestCalculate", "CalculatorTestPrecedence", "CalculatorTestApplyOperator", "CalculatorTest" ]
class Calculator: def __init__(self): """ Initialize the operations performed by the five operators'+','-','*','/','^' """ self.operators = { '+': lambda x, y: x + y, '-': lambda x, y: x - y, '*': lambda x, y: x * y, '/': lambda x, y: ...
[ "self.operators" ]
ClassEval_16_t47
47
apply_operator
def apply_operator(self, operand_stack, operator_stack):
class Calculator: def __init__(self): self.operators = { '+': lambda x, y: x + y, '-': lambda x, y: x - y, '*': lambda x, y: x * y, '/': lambda x, y: x / y, '^': lambda x, y: x ** y } def calculate(self, expression): operand_st...
operand_stack.append(result)
return operand_stack, operator_stack
ClassEval_16
class Calculator: """ This is a class for a calculator, capable of performing basic arithmetic calculations on numerical expressions using the operators +, -, *, /, and ^ (exponentiation). """ def __init__(self): """ Initialize the operations performed by the five operators'+','-','*','...
import unittest class CalculatorTestCalculate(unittest.TestCase): def test_calculate_1(self): calculator = Calculator() res = calculator.calculate('1+2') self.assertEqual(res, 3) def test_calculate_2(self): calculator = Calculator() res = calculator.calculate('1+2*3') ...
class Calculator: def __init__(self): self.operators = { '+': lambda x, y: x + y, '-': lambda x, y: x - y, '*': lambda x, y: x * y, '/': lambda x, y: x / y, '^': lambda x, y: x ** y } def calculate(self, expression): operand_st...
[]
""" This is a class for a calculator, capable of performing basic arithmetic calculations on numerical expressions using the operators +, -, *, /, and ^ (exponentiation). """
[ { "dependencies": { "Standalone": false, "field_dependencies": [], "lib_dependencies": [], "method_dependencies": [ "precedence", "apply_operator" ] }, "method_description": "def calculate(self, expression):\n \"\"\"\n Calculate the value of a ...
Calculator
[ "CalculatorTestCalculate", "CalculatorTestPrecedence", "CalculatorTestApplyOperator", "CalculatorTest" ]
class Calculator: def __init__(self): """ Initialize the operations performed by the five operators'+','-','*','/','^' """ self.operators = { '+': lambda x, y: x + y, '-': lambda x, y: x - y, '*': lambda x, y: x * y, '/': lambda x, y: ...
[ "self.operators" ]
ClassEval_16_t48
48
apply_operator
def apply_operator(self, operand_stack, operator_stack):
class Calculator: def __init__(self): self.operators = { '+': lambda x, y: x + y, '-': lambda x, y: x - y, '*': lambda x, y: x * y, '/': lambda x, y: x / y, '^': lambda x, y: x ** y } def calculate(self, expression): operand_st...
return operand_stack, operator_stack
ClassEval_17
from datetime import datetime, timedelta class CalendarUtil: """ This is a class as CalendarUtil that provides functionalities to manage calendar events, schedule appointments, and perform conflict checks. """ def __init__(self): """ Initialize the calendar with an empty list of events...
import unittest from datetime import datetime class CalendarTestAddEvent(unittest.TestCase): def test_add_event(self): calendar = CalendarUtil() calendar.add_event({'date': datetime(2023, 1, 1, 0, 0), 'start_time': datetime(2023, 1, 1, 0, 0), 'end_time': datetime(2023, ...
from datetime import datetime, timedelta class CalendarUtil: def __init__(self): self.events = [] def add_event(self, event): self.events.append(event) def remove_event(self, event): if event in self.events: self.events.remove(event) def get_events(self, date): ...
[ "from datetime import datetime, timedelta" ]
""" This is a class as CalendarUtil that provides functionalities to manage calendar events, schedule appointments, and perform conflict checks. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.events" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_event(self, event):\n \"\"\"\n Add an event to the calendar.\n :param event: Th...
CalendarUtil
[ "CalendarTestAddEvent", "CalendarTestRemoveEvent", "CalendarTestGetEvents", "CalendarTestIsAvailable", "CalendarTestGetAvailableSlots", "CalendarTestGetUpcomingEvents", "CalendarTestMain" ]
class CalendarUtil: def __init__(self): """ Initialize the calendar with an empty list of events. """ self.events = []
[ "self.events" ]
ClassEval_17_t0
0
add_event
def add_event(self, event):
from datetime import datetime, timedelta class CalendarUtil: def __init__(self): self.events = [] def add_event(self, event):
self.events.append(event)
def remove_event(self, event): if event in self.events: self.events.remove(event) def get_events(self, date): events_on_date = [] for event in self.events: if event['date'].date() == date.date(): events_on_date.append(event) return events...
ClassEval_17
from datetime import datetime, timedelta class CalendarUtil: """ This is a class as CalendarUtil that provides functionalities to manage calendar events, schedule appointments, and perform conflict checks. """ def __init__(self): """ Initialize the calendar with an empty list of events...
import unittest from datetime import datetime class CalendarTestAddEvent(unittest.TestCase): def test_add_event(self): calendar = CalendarUtil() calendar.add_event({'date': datetime(2023, 1, 1, 0, 0), 'start_time': datetime(2023, 1, 1, 0, 0), 'end_time': datetime(2023, ...
from datetime import datetime, timedelta class CalendarUtil: def __init__(self): self.events = [] def add_event(self, event): self.events.append(event) def remove_event(self, event): if event in self.events: self.events.remove(event) def get_events(self, date): ...
[ "from datetime import datetime, timedelta" ]
""" This is a class as CalendarUtil that provides functionalities to manage calendar events, schedule appointments, and perform conflict checks. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.events" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_event(self, event):\n \"\"\"\n Add an event to the calendar.\n :param event: Th...
CalendarUtil
[ "CalendarTestAddEvent", "CalendarTestRemoveEvent", "CalendarTestGetEvents", "CalendarTestIsAvailable", "CalendarTestGetAvailableSlots", "CalendarTestGetUpcomingEvents", "CalendarTestMain" ]
class CalendarUtil: def __init__(self): """ Initialize the calendar with an empty list of events. """ self.events = []
[ "self.events" ]
ClassEval_17_t1
1
remove_event
def remove_event(self, event):
from datetime import datetime, timedelta class CalendarUtil: def __init__(self): self.events = [] def add_event(self, event): self.events.append(event) def remove_event(self, event):
if event in self.events:
self.events.remove(event) def get_events(self, date): events_on_date = [] for event in self.events: if event['date'].date() == date.date(): events_on_date.append(event) return events_on_date def is_available(self, start_time, end_time): f...
ClassEval_17
from datetime import datetime, timedelta class CalendarUtil: """ This is a class as CalendarUtil that provides functionalities to manage calendar events, schedule appointments, and perform conflict checks. """ def __init__(self): """ Initialize the calendar with an empty list of events...
import unittest from datetime import datetime class CalendarTestAddEvent(unittest.TestCase): def test_add_event(self): calendar = CalendarUtil() calendar.add_event({'date': datetime(2023, 1, 1, 0, 0), 'start_time': datetime(2023, 1, 1, 0, 0), 'end_time': datetime(2023, ...
from datetime import datetime, timedelta class CalendarUtil: def __init__(self): self.events = [] def add_event(self, event): self.events.append(event) def remove_event(self, event): if event in self.events: self.events.remove(event) def get_events(self, date): ...
[ "from datetime import datetime, timedelta" ]
""" This is a class as CalendarUtil that provides functionalities to manage calendar events, schedule appointments, and perform conflict checks. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.events" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_event(self, event):\n \"\"\"\n Add an event to the calendar.\n :param event: Th...
CalendarUtil
[ "CalendarTestAddEvent", "CalendarTestRemoveEvent", "CalendarTestGetEvents", "CalendarTestIsAvailable", "CalendarTestGetAvailableSlots", "CalendarTestGetUpcomingEvents", "CalendarTestMain" ]
class CalendarUtil: def __init__(self): """ Initialize the calendar with an empty list of events. """ self.events = []
[ "self.events" ]
ClassEval_17_t2
2
remove_event
def remove_event(self, event):
from datetime import datetime, timedelta class CalendarUtil: def __init__(self): self.events = [] def add_event(self, event): self.events.append(event) def remove_event(self, event): if event in self.events:
self.events.remove(event)
def get_events(self, date): events_on_date = [] for event in self.events: if event['date'].date() == date.date(): events_on_date.append(event) return events_on_date def is_available(self, start_time, end_time): for event in self.events: i...
ClassEval_17
from datetime import datetime, timedelta class CalendarUtil: """ This is a class as CalendarUtil that provides functionalities to manage calendar events, schedule appointments, and perform conflict checks. """ def __init__(self): """ Initialize the calendar with an empty list of events...
import unittest from datetime import datetime class CalendarTestAddEvent(unittest.TestCase): def test_add_event(self): calendar = CalendarUtil() calendar.add_event({'date': datetime(2023, 1, 1, 0, 0), 'start_time': datetime(2023, 1, 1, 0, 0), 'end_time': datetime(2023, ...
from datetime import datetime, timedelta class CalendarUtil: def __init__(self): self.events = [] def add_event(self, event): self.events.append(event) def remove_event(self, event): if event in self.events: self.events.remove(event) def get_events(self, date): ...
[ "from datetime import datetime, timedelta" ]
""" This is a class as CalendarUtil that provides functionalities to manage calendar events, schedule appointments, and perform conflict checks. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.events" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_event(self, event):\n \"\"\"\n Add an event to the calendar.\n :param event: Th...
CalendarUtil
[ "CalendarTestAddEvent", "CalendarTestRemoveEvent", "CalendarTestGetEvents", "CalendarTestIsAvailable", "CalendarTestGetAvailableSlots", "CalendarTestGetUpcomingEvents", "CalendarTestMain" ]
class CalendarUtil: def __init__(self): """ Initialize the calendar with an empty list of events. """ self.events = []
[ "self.events" ]
ClassEval_17_t3
3
get_events
def get_events(self, date):
from datetime import datetime, timedelta class CalendarUtil: def __init__(self): self.events = [] def add_event(self, event): self.events.append(event) def remove_event(self, event): if event in self.events: self.events.remove(event) def get_events(self, date):
events_on_date = []
for event in self.events: if event['date'].date() == date.date(): events_on_date.append(event) return events_on_date def is_available(self, start_time, end_time): for event in self.events: if start_time < event['end_time'] and end_time > event['start_...
ClassEval_17
from datetime import datetime, timedelta class CalendarUtil: """ This is a class as CalendarUtil that provides functionalities to manage calendar events, schedule appointments, and perform conflict checks. """ def __init__(self): """ Initialize the calendar with an empty list of events...
import unittest from datetime import datetime class CalendarTestAddEvent(unittest.TestCase): def test_add_event(self): calendar = CalendarUtil() calendar.add_event({'date': datetime(2023, 1, 1, 0, 0), 'start_time': datetime(2023, 1, 1, 0, 0), 'end_time': datetime(2023, ...
from datetime import datetime, timedelta class CalendarUtil: def __init__(self): self.events = [] def add_event(self, event): self.events.append(event) def remove_event(self, event): if event in self.events: self.events.remove(event) def get_events(self, date): ...
[ "from datetime import datetime, timedelta" ]
""" This is a class as CalendarUtil that provides functionalities to manage calendar events, schedule appointments, and perform conflict checks. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.events" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_event(self, event):\n \"\"\"\n Add an event to the calendar.\n :param event: Th...
CalendarUtil
[ "CalendarTestAddEvent", "CalendarTestRemoveEvent", "CalendarTestGetEvents", "CalendarTestIsAvailable", "CalendarTestGetAvailableSlots", "CalendarTestGetUpcomingEvents", "CalendarTestMain" ]
class CalendarUtil: def __init__(self): """ Initialize the calendar with an empty list of events. """ self.events = []
[ "self.events" ]
ClassEval_17_t4
4
get_events
def get_events(self, date):
from datetime import datetime, timedelta class CalendarUtil: def __init__(self): self.events = [] def add_event(self, event): self.events.append(event) def remove_event(self, event): if event in self.events: self.events.remove(event) def get_events(self, date): ...
for event in self.events:
if event['date'].date() == date.date(): events_on_date.append(event) return events_on_date def is_available(self, start_time, end_time): for event in self.events: if start_time < event['end_time'] and end_time > event['start_time']: return Fal...
ClassEval_17
from datetime import datetime, timedelta class CalendarUtil: """ This is a class as CalendarUtil that provides functionalities to manage calendar events, schedule appointments, and perform conflict checks. """ def __init__(self): """ Initialize the calendar with an empty list of events...
import unittest from datetime import datetime class CalendarTestAddEvent(unittest.TestCase): def test_add_event(self): calendar = CalendarUtil() calendar.add_event({'date': datetime(2023, 1, 1, 0, 0), 'start_time': datetime(2023, 1, 1, 0, 0), 'end_time': datetime(2023, ...
from datetime import datetime, timedelta class CalendarUtil: def __init__(self): self.events = [] def add_event(self, event): self.events.append(event) def remove_event(self, event): if event in self.events: self.events.remove(event) def get_events(self, date): ...
[ "from datetime import datetime, timedelta" ]
""" This is a class as CalendarUtil that provides functionalities to manage calendar events, schedule appointments, and perform conflict checks. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.events" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_event(self, event):\n \"\"\"\n Add an event to the calendar.\n :param event: Th...
CalendarUtil
[ "CalendarTestAddEvent", "CalendarTestRemoveEvent", "CalendarTestGetEvents", "CalendarTestIsAvailable", "CalendarTestGetAvailableSlots", "CalendarTestGetUpcomingEvents", "CalendarTestMain" ]
class CalendarUtil: def __init__(self): """ Initialize the calendar with an empty list of events. """ self.events = []
[ "self.events" ]
ClassEval_17_t5
5
get_events
def get_events(self, date):
from datetime import datetime, timedelta class CalendarUtil: def __init__(self): self.events = [] def add_event(self, event): self.events.append(event) def remove_event(self, event): if event in self.events: self.events.remove(event) def get_events(self, date): ...
if event['date'].date() == date.date():
events_on_date.append(event) return events_on_date def is_available(self, start_time, end_time): for event in self.events: if start_time < event['end_time'] and end_time > event['start_time']: return False return True def get_available_slots(...
ClassEval_17
from datetime import datetime, timedelta class CalendarUtil: """ This is a class as CalendarUtil that provides functionalities to manage calendar events, schedule appointments, and perform conflict checks. """ def __init__(self): """ Initialize the calendar with an empty list of events...
import unittest from datetime import datetime class CalendarTestAddEvent(unittest.TestCase): def test_add_event(self): calendar = CalendarUtil() calendar.add_event({'date': datetime(2023, 1, 1, 0, 0), 'start_time': datetime(2023, 1, 1, 0, 0), 'end_time': datetime(2023, ...
from datetime import datetime, timedelta class CalendarUtil: def __init__(self): self.events = [] def add_event(self, event): self.events.append(event) def remove_event(self, event): if event in self.events: self.events.remove(event) def get_events(self, date): ...
[ "from datetime import datetime, timedelta" ]
""" This is a class as CalendarUtil that provides functionalities to manage calendar events, schedule appointments, and perform conflict checks. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.events" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_event(self, event):\n \"\"\"\n Add an event to the calendar.\n :param event: Th...
CalendarUtil
[ "CalendarTestAddEvent", "CalendarTestRemoveEvent", "CalendarTestGetEvents", "CalendarTestIsAvailable", "CalendarTestGetAvailableSlots", "CalendarTestGetUpcomingEvents", "CalendarTestMain" ]
class CalendarUtil: def __init__(self): """ Initialize the calendar with an empty list of events. """ self.events = []
[ "self.events" ]
ClassEval_17_t6
6
get_events
def get_events(self, date):
from datetime import datetime, timedelta class CalendarUtil: def __init__(self): self.events = [] def add_event(self, event): self.events.append(event) def remove_event(self, event): if event in self.events: self.events.remove(event) def get_events(self, date): ...
events_on_date.append(event)
return events_on_date def is_available(self, start_time, end_time): for event in self.events: if start_time < event['end_time'] and end_time > event['start_time']: return False return True def get_available_slots(self, date): available_slots = [] ...
ClassEval_17
from datetime import datetime, timedelta class CalendarUtil: """ This is a class as CalendarUtil that provides functionalities to manage calendar events, schedule appointments, and perform conflict checks. """ def __init__(self): """ Initialize the calendar with an empty list of events...
import unittest from datetime import datetime class CalendarTestAddEvent(unittest.TestCase): def test_add_event(self): calendar = CalendarUtil() calendar.add_event({'date': datetime(2023, 1, 1, 0, 0), 'start_time': datetime(2023, 1, 1, 0, 0), 'end_time': datetime(2023, ...
from datetime import datetime, timedelta class CalendarUtil: def __init__(self): self.events = [] def add_event(self, event): self.events.append(event) def remove_event(self, event): if event in self.events: self.events.remove(event) def get_events(self, date): ...
[ "from datetime import datetime, timedelta" ]
""" This is a class as CalendarUtil that provides functionalities to manage calendar events, schedule appointments, and perform conflict checks. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.events" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_event(self, event):\n \"\"\"\n Add an event to the calendar.\n :param event: Th...
CalendarUtil
[ "CalendarTestAddEvent", "CalendarTestRemoveEvent", "CalendarTestGetEvents", "CalendarTestIsAvailable", "CalendarTestGetAvailableSlots", "CalendarTestGetUpcomingEvents", "CalendarTestMain" ]
class CalendarUtil: def __init__(self): """ Initialize the calendar with an empty list of events. """ self.events = []
[ "self.events" ]
ClassEval_17_t7
7
get_events
def get_events(self, date):
from datetime import datetime, timedelta class CalendarUtil: def __init__(self): self.events = [] def add_event(self, event): self.events.append(event) def remove_event(self, event): if event in self.events: self.events.remove(event) def get_events(self, date): ...
return events_on_date
def is_available(self, start_time, end_time): for event in self.events: if start_time < event['end_time'] and end_time > event['start_time']: return False return True def get_available_slots(self, date): available_slots = [] start_time = datetime(dat...
ClassEval_17
from datetime import datetime, timedelta class CalendarUtil: """ This is a class as CalendarUtil that provides functionalities to manage calendar events, schedule appointments, and perform conflict checks. """ def __init__(self): """ Initialize the calendar with an empty list of events...
import unittest from datetime import datetime class CalendarTestAddEvent(unittest.TestCase): def test_add_event(self): calendar = CalendarUtil() calendar.add_event({'date': datetime(2023, 1, 1, 0, 0), 'start_time': datetime(2023, 1, 1, 0, 0), 'end_time': datetime(2023, ...
from datetime import datetime, timedelta class CalendarUtil: def __init__(self): self.events = [] def add_event(self, event): self.events.append(event) def remove_event(self, event): if event in self.events: self.events.remove(event) def get_events(self, date): ...
[ "from datetime import datetime, timedelta" ]
""" This is a class as CalendarUtil that provides functionalities to manage calendar events, schedule appointments, and perform conflict checks. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.events" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_event(self, event):\n \"\"\"\n Add an event to the calendar.\n :param event: Th...
CalendarUtil
[ "CalendarTestAddEvent", "CalendarTestRemoveEvent", "CalendarTestGetEvents", "CalendarTestIsAvailable", "CalendarTestGetAvailableSlots", "CalendarTestGetUpcomingEvents", "CalendarTestMain" ]
class CalendarUtil: def __init__(self): """ Initialize the calendar with an empty list of events. """ self.events = []
[ "self.events" ]
ClassEval_17_t8
8
is_available
def is_available(self, start_time, end_time):
from datetime import datetime, timedelta class CalendarUtil: def __init__(self): self.events = [] def add_event(self, event): self.events.append(event) def remove_event(self, event): if event in self.events: self.events.remove(event) def get_events(self, date): ...
for event in self.events:
if start_time < event['end_time'] and end_time > event['start_time']: return False return True def get_available_slots(self, date): available_slots = [] start_time = datetime(date.year, date.month, date.day, 0, 0) end_time = datetime(date.year, date.month...
ClassEval_17
from datetime import datetime, timedelta class CalendarUtil: """ This is a class as CalendarUtil that provides functionalities to manage calendar events, schedule appointments, and perform conflict checks. """ def __init__(self): """ Initialize the calendar with an empty list of events...
import unittest from datetime import datetime class CalendarTestAddEvent(unittest.TestCase): def test_add_event(self): calendar = CalendarUtil() calendar.add_event({'date': datetime(2023, 1, 1, 0, 0), 'start_time': datetime(2023, 1, 1, 0, 0), 'end_time': datetime(2023, ...
from datetime import datetime, timedelta class CalendarUtil: def __init__(self): self.events = [] def add_event(self, event): self.events.append(event) def remove_event(self, event): if event in self.events: self.events.remove(event) def get_events(self, date): ...
[ "from datetime import datetime, timedelta" ]
""" This is a class as CalendarUtil that provides functionalities to manage calendar events, schedule appointments, and perform conflict checks. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.events" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_event(self, event):\n \"\"\"\n Add an event to the calendar.\n :param event: Th...
CalendarUtil
[ "CalendarTestAddEvent", "CalendarTestRemoveEvent", "CalendarTestGetEvents", "CalendarTestIsAvailable", "CalendarTestGetAvailableSlots", "CalendarTestGetUpcomingEvents", "CalendarTestMain" ]
class CalendarUtil: def __init__(self): """ Initialize the calendar with an empty list of events. """ self.events = []
[ "self.events" ]
ClassEval_17_t9
9
is_available
def is_available(self, start_time, end_time):
from datetime import datetime, timedelta class CalendarUtil: def __init__(self): self.events = [] def add_event(self, event): self.events.append(event) def remove_event(self, event): if event in self.events: self.events.remove(event) def get_events(self, date): ...
if start_time < event['end_time'] and end_time > event['start_time']:
return False return True def get_available_slots(self, date): available_slots = [] start_time = datetime(date.year, date.month, date.day, 0, 0) end_time = datetime(date.year, date.month, date.day, 23, 59) while start_time < end_time: slot_end_tim...
ClassEval_17
from datetime import datetime, timedelta class CalendarUtil: """ This is a class as CalendarUtil that provides functionalities to manage calendar events, schedule appointments, and perform conflict checks. """ def __init__(self): """ Initialize the calendar with an empty list of events...
import unittest from datetime import datetime class CalendarTestAddEvent(unittest.TestCase): def test_add_event(self): calendar = CalendarUtil() calendar.add_event({'date': datetime(2023, 1, 1, 0, 0), 'start_time': datetime(2023, 1, 1, 0, 0), 'end_time': datetime(2023, ...
from datetime import datetime, timedelta class CalendarUtil: def __init__(self): self.events = [] def add_event(self, event): self.events.append(event) def remove_event(self, event): if event in self.events: self.events.remove(event) def get_events(self, date): ...
[ "from datetime import datetime, timedelta" ]
""" This is a class as CalendarUtil that provides functionalities to manage calendar events, schedule appointments, and perform conflict checks. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.events" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_event(self, event):\n \"\"\"\n Add an event to the calendar.\n :param event: Th...
CalendarUtil
[ "CalendarTestAddEvent", "CalendarTestRemoveEvent", "CalendarTestGetEvents", "CalendarTestIsAvailable", "CalendarTestGetAvailableSlots", "CalendarTestGetUpcomingEvents", "CalendarTestMain" ]
class CalendarUtil: def __init__(self): """ Initialize the calendar with an empty list of events. """ self.events = []
[ "self.events" ]
ClassEval_17_t10
10
is_available
def is_available(self, start_time, end_time):
from datetime import datetime, timedelta class CalendarUtil: def __init__(self): self.events = [] def add_event(self, event): self.events.append(event) def remove_event(self, event): if event in self.events: self.events.remove(event) def get_events(self, date): ...
return False
return True def get_available_slots(self, date): available_slots = [] start_time = datetime(date.year, date.month, date.day, 0, 0) end_time = datetime(date.year, date.month, date.day, 23, 59) while start_time < end_time: slot_end_time = start_time + timedelta(mi...
ClassEval_17
from datetime import datetime, timedelta class CalendarUtil: """ This is a class as CalendarUtil that provides functionalities to manage calendar events, schedule appointments, and perform conflict checks. """ def __init__(self): """ Initialize the calendar with an empty list of events...
import unittest from datetime import datetime class CalendarTestAddEvent(unittest.TestCase): def test_add_event(self): calendar = CalendarUtil() calendar.add_event({'date': datetime(2023, 1, 1, 0, 0), 'start_time': datetime(2023, 1, 1, 0, 0), 'end_time': datetime(2023, ...
from datetime import datetime, timedelta class CalendarUtil: def __init__(self): self.events = [] def add_event(self, event): self.events.append(event) def remove_event(self, event): if event in self.events: self.events.remove(event) def get_events(self, date): ...
[ "from datetime import datetime, timedelta" ]
""" This is a class as CalendarUtil that provides functionalities to manage calendar events, schedule appointments, and perform conflict checks. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.events" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_event(self, event):\n \"\"\"\n Add an event to the calendar.\n :param event: Th...
CalendarUtil
[ "CalendarTestAddEvent", "CalendarTestRemoveEvent", "CalendarTestGetEvents", "CalendarTestIsAvailable", "CalendarTestGetAvailableSlots", "CalendarTestGetUpcomingEvents", "CalendarTestMain" ]
class CalendarUtil: def __init__(self): """ Initialize the calendar with an empty list of events. """ self.events = []
[ "self.events" ]
ClassEval_17_t11
11
is_available
def is_available(self, start_time, end_time):
from datetime import datetime, timedelta class CalendarUtil: def __init__(self): self.events = [] def add_event(self, event): self.events.append(event) def remove_event(self, event): if event in self.events: self.events.remove(event) def get_events(self, date): ...
return True
def get_available_slots(self, date): available_slots = [] start_time = datetime(date.year, date.month, date.day, 0, 0) end_time = datetime(date.year, date.month, date.day, 23, 59) while start_time < end_time: slot_end_time = start_time + timedelta(minutes=60) ...
ClassEval_17
from datetime import datetime, timedelta class CalendarUtil: """ This is a class as CalendarUtil that provides functionalities to manage calendar events, schedule appointments, and perform conflict checks. """ def __init__(self): """ Initialize the calendar with an empty list of events...
import unittest from datetime import datetime class CalendarTestAddEvent(unittest.TestCase): def test_add_event(self): calendar = CalendarUtil() calendar.add_event({'date': datetime(2023, 1, 1, 0, 0), 'start_time': datetime(2023, 1, 1, 0, 0), 'end_time': datetime(2023, ...
from datetime import datetime, timedelta class CalendarUtil: def __init__(self): self.events = [] def add_event(self, event): self.events.append(event) def remove_event(self, event): if event in self.events: self.events.remove(event) def get_events(self, date): ...
[ "from datetime import datetime, timedelta" ]
""" This is a class as CalendarUtil that provides functionalities to manage calendar events, schedule appointments, and perform conflict checks. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.events" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_event(self, event):\n \"\"\"\n Add an event to the calendar.\n :param event: Th...
CalendarUtil
[ "CalendarTestAddEvent", "CalendarTestRemoveEvent", "CalendarTestGetEvents", "CalendarTestIsAvailable", "CalendarTestGetAvailableSlots", "CalendarTestGetUpcomingEvents", "CalendarTestMain" ]
class CalendarUtil: def __init__(self): """ Initialize the calendar with an empty list of events. """ self.events = []
[ "self.events" ]
ClassEval_17_t12
12
get_available_slots
def get_available_slots(self, date):
from datetime import datetime, timedelta class CalendarUtil: def __init__(self): self.events = [] def add_event(self, event): self.events.append(event) def remove_event(self, event): if event in self.events: self.events.remove(event) def get_events(self, date): ...
available_slots = []
start_time = datetime(date.year, date.month, date.day, 0, 0) end_time = datetime(date.year, date.month, date.day, 23, 59) while start_time < end_time: slot_end_time = start_time + timedelta(minutes=60) if self.is_available(start_time, slot_end_time): avai...
ClassEval_17
from datetime import datetime, timedelta class CalendarUtil: """ This is a class as CalendarUtil that provides functionalities to manage calendar events, schedule appointments, and perform conflict checks. """ def __init__(self): """ Initialize the calendar with an empty list of events...
import unittest from datetime import datetime class CalendarTestAddEvent(unittest.TestCase): def test_add_event(self): calendar = CalendarUtil() calendar.add_event({'date': datetime(2023, 1, 1, 0, 0), 'start_time': datetime(2023, 1, 1, 0, 0), 'end_time': datetime(2023, ...
from datetime import datetime, timedelta class CalendarUtil: def __init__(self): self.events = [] def add_event(self, event): self.events.append(event) def remove_event(self, event): if event in self.events: self.events.remove(event) def get_events(self, date): ...
[ "from datetime import datetime, timedelta" ]
""" This is a class as CalendarUtil that provides functionalities to manage calendar events, schedule appointments, and perform conflict checks. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.events" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_event(self, event):\n \"\"\"\n Add an event to the calendar.\n :param event: Th...
CalendarUtil
[ "CalendarTestAddEvent", "CalendarTestRemoveEvent", "CalendarTestGetEvents", "CalendarTestIsAvailable", "CalendarTestGetAvailableSlots", "CalendarTestGetUpcomingEvents", "CalendarTestMain" ]
class CalendarUtil: def __init__(self): """ Initialize the calendar with an empty list of events. """ self.events = []
[ "self.events" ]
ClassEval_17_t13
13
get_available_slots
def get_available_slots(self, date):
from datetime import datetime, timedelta class CalendarUtil: def __init__(self): self.events = [] def add_event(self, event): self.events.append(event) def remove_event(self, event): if event in self.events: self.events.remove(event) def get_events(self, date): ...
start_time = datetime(date.year, date.month, date.day, 0, 0)
end_time = datetime(date.year, date.month, date.day, 23, 59) while start_time < end_time: slot_end_time = start_time + timedelta(minutes=60) if self.is_available(start_time, slot_end_time): available_slots.append((start_time, slot_end_time)) start_tim...
ClassEval_17
from datetime import datetime, timedelta class CalendarUtil: """ This is a class as CalendarUtil that provides functionalities to manage calendar events, schedule appointments, and perform conflict checks. """ def __init__(self): """ Initialize the calendar with an empty list of events...
import unittest from datetime import datetime class CalendarTestAddEvent(unittest.TestCase): def test_add_event(self): calendar = CalendarUtil() calendar.add_event({'date': datetime(2023, 1, 1, 0, 0), 'start_time': datetime(2023, 1, 1, 0, 0), 'end_time': datetime(2023, ...
from datetime import datetime, timedelta class CalendarUtil: def __init__(self): self.events = [] def add_event(self, event): self.events.append(event) def remove_event(self, event): if event in self.events: self.events.remove(event) def get_events(self, date): ...
[ "from datetime import datetime, timedelta" ]
""" This is a class as CalendarUtil that provides functionalities to manage calendar events, schedule appointments, and perform conflict checks. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.events" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_event(self, event):\n \"\"\"\n Add an event to the calendar.\n :param event: Th...
CalendarUtil
[ "CalendarTestAddEvent", "CalendarTestRemoveEvent", "CalendarTestGetEvents", "CalendarTestIsAvailable", "CalendarTestGetAvailableSlots", "CalendarTestGetUpcomingEvents", "CalendarTestMain" ]
class CalendarUtil: def __init__(self): """ Initialize the calendar with an empty list of events. """ self.events = []
[ "self.events" ]
ClassEval_17_t14
14
get_available_slots
def get_available_slots(self, date):
from datetime import datetime, timedelta class CalendarUtil: def __init__(self): self.events = [] def add_event(self, event): self.events.append(event) def remove_event(self, event): if event in self.events: self.events.remove(event) def get_events(self, date): ...
end_time = datetime(date.year, date.month, date.day, 23, 59)
while start_time < end_time: slot_end_time = start_time + timedelta(minutes=60) if self.is_available(start_time, slot_end_time): available_slots.append((start_time, slot_end_time)) start_time += timedelta(minutes=60) return available_slots def ...
ClassEval_17
from datetime import datetime, timedelta class CalendarUtil: """ This is a class as CalendarUtil that provides functionalities to manage calendar events, schedule appointments, and perform conflict checks. """ def __init__(self): """ Initialize the calendar with an empty list of events...
import unittest from datetime import datetime class CalendarTestAddEvent(unittest.TestCase): def test_add_event(self): calendar = CalendarUtil() calendar.add_event({'date': datetime(2023, 1, 1, 0, 0), 'start_time': datetime(2023, 1, 1, 0, 0), 'end_time': datetime(2023, ...
from datetime import datetime, timedelta class CalendarUtil: def __init__(self): self.events = [] def add_event(self, event): self.events.append(event) def remove_event(self, event): if event in self.events: self.events.remove(event) def get_events(self, date): ...
[ "from datetime import datetime, timedelta" ]
""" This is a class as CalendarUtil that provides functionalities to manage calendar events, schedule appointments, and perform conflict checks. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.events" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_event(self, event):\n \"\"\"\n Add an event to the calendar.\n :param event: Th...
CalendarUtil
[ "CalendarTestAddEvent", "CalendarTestRemoveEvent", "CalendarTestGetEvents", "CalendarTestIsAvailable", "CalendarTestGetAvailableSlots", "CalendarTestGetUpcomingEvents", "CalendarTestMain" ]
class CalendarUtil: def __init__(self): """ Initialize the calendar with an empty list of events. """ self.events = []
[ "self.events" ]
ClassEval_17_t15
15
get_available_slots
def get_available_slots(self, date):
from datetime import datetime, timedelta class CalendarUtil: def __init__(self): self.events = [] def add_event(self, event): self.events.append(event) def remove_event(self, event): if event in self.events: self.events.remove(event) def get_events(self, date): ...
while start_time < end_time:
slot_end_time = start_time + timedelta(minutes=60) if self.is_available(start_time, slot_end_time): available_slots.append((start_time, slot_end_time)) start_time += timedelta(minutes=60) return available_slots def get_upcoming_events(self, num_events):...
ClassEval_17
from datetime import datetime, timedelta class CalendarUtil: """ This is a class as CalendarUtil that provides functionalities to manage calendar events, schedule appointments, and perform conflict checks. """ def __init__(self): """ Initialize the calendar with an empty list of events...
import unittest from datetime import datetime class CalendarTestAddEvent(unittest.TestCase): def test_add_event(self): calendar = CalendarUtil() calendar.add_event({'date': datetime(2023, 1, 1, 0, 0), 'start_time': datetime(2023, 1, 1, 0, 0), 'end_time': datetime(2023, ...
from datetime import datetime, timedelta class CalendarUtil: def __init__(self): self.events = [] def add_event(self, event): self.events.append(event) def remove_event(self, event): if event in self.events: self.events.remove(event) def get_events(self, date): ...
[ "from datetime import datetime, timedelta" ]
""" This is a class as CalendarUtil that provides functionalities to manage calendar events, schedule appointments, and perform conflict checks. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.events" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_event(self, event):\n \"\"\"\n Add an event to the calendar.\n :param event: Th...
CalendarUtil
[ "CalendarTestAddEvent", "CalendarTestRemoveEvent", "CalendarTestGetEvents", "CalendarTestIsAvailable", "CalendarTestGetAvailableSlots", "CalendarTestGetUpcomingEvents", "CalendarTestMain" ]
class CalendarUtil: def __init__(self): """ Initialize the calendar with an empty list of events. """ self.events = []
[ "self.events" ]
ClassEval_17_t16
16
get_available_slots
def get_available_slots(self, date):
from datetime import datetime, timedelta class CalendarUtil: def __init__(self): self.events = [] def add_event(self, event): self.events.append(event) def remove_event(self, event): if event in self.events: self.events.remove(event) def get_events(self, date): ...
slot_end_time = start_time + timedelta(minutes=60)
if self.is_available(start_time, slot_end_time): available_slots.append((start_time, slot_end_time)) start_time += timedelta(minutes=60) return available_slots def get_upcoming_events(self, num_events): now = datetime.now() upcoming_events = [] ...
ClassEval_17
from datetime import datetime, timedelta class CalendarUtil: """ This is a class as CalendarUtil that provides functionalities to manage calendar events, schedule appointments, and perform conflict checks. """ def __init__(self): """ Initialize the calendar with an empty list of events...
import unittest from datetime import datetime class CalendarTestAddEvent(unittest.TestCase): def test_add_event(self): calendar = CalendarUtil() calendar.add_event({'date': datetime(2023, 1, 1, 0, 0), 'start_time': datetime(2023, 1, 1, 0, 0), 'end_time': datetime(2023, ...
from datetime import datetime, timedelta class CalendarUtil: def __init__(self): self.events = [] def add_event(self, event): self.events.append(event) def remove_event(self, event): if event in self.events: self.events.remove(event) def get_events(self, date): ...
[ "from datetime import datetime, timedelta" ]
""" This is a class as CalendarUtil that provides functionalities to manage calendar events, schedule appointments, and perform conflict checks. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.events" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_event(self, event):\n \"\"\"\n Add an event to the calendar.\n :param event: Th...
CalendarUtil
[ "CalendarTestAddEvent", "CalendarTestRemoveEvent", "CalendarTestGetEvents", "CalendarTestIsAvailable", "CalendarTestGetAvailableSlots", "CalendarTestGetUpcomingEvents", "CalendarTestMain" ]
class CalendarUtil: def __init__(self): """ Initialize the calendar with an empty list of events. """ self.events = []
[ "self.events" ]
ClassEval_17_t17
17
get_available_slots
def get_available_slots(self, date):
from datetime import datetime, timedelta class CalendarUtil: def __init__(self): self.events = [] def add_event(self, event): self.events.append(event) def remove_event(self, event): if event in self.events: self.events.remove(event) def get_events(self, date): ...
if self.is_available(start_time, slot_end_time):
available_slots.append((start_time, slot_end_time)) start_time += timedelta(minutes=60) return available_slots def get_upcoming_events(self, num_events): now = datetime.now() upcoming_events = [] for event in self.events: if event['start_tim...
ClassEval_17
from datetime import datetime, timedelta class CalendarUtil: """ This is a class as CalendarUtil that provides functionalities to manage calendar events, schedule appointments, and perform conflict checks. """ def __init__(self): """ Initialize the calendar with an empty list of events...
import unittest from datetime import datetime class CalendarTestAddEvent(unittest.TestCase): def test_add_event(self): calendar = CalendarUtil() calendar.add_event({'date': datetime(2023, 1, 1, 0, 0), 'start_time': datetime(2023, 1, 1, 0, 0), 'end_time': datetime(2023, ...
from datetime import datetime, timedelta class CalendarUtil: def __init__(self): self.events = [] def add_event(self, event): self.events.append(event) def remove_event(self, event): if event in self.events: self.events.remove(event) def get_events(self, date): ...
[ "from datetime import datetime, timedelta" ]
""" This is a class as CalendarUtil that provides functionalities to manage calendar events, schedule appointments, and perform conflict checks. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.events" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_event(self, event):\n \"\"\"\n Add an event to the calendar.\n :param event: Th...
CalendarUtil
[ "CalendarTestAddEvent", "CalendarTestRemoveEvent", "CalendarTestGetEvents", "CalendarTestIsAvailable", "CalendarTestGetAvailableSlots", "CalendarTestGetUpcomingEvents", "CalendarTestMain" ]
class CalendarUtil: def __init__(self): """ Initialize the calendar with an empty list of events. """ self.events = []
[ "self.events" ]
ClassEval_17_t18
18
get_available_slots
def get_available_slots(self, date):
from datetime import datetime, timedelta class CalendarUtil: def __init__(self): self.events = [] def add_event(self, event): self.events.append(event) def remove_event(self, event): if event in self.events: self.events.remove(event) def get_events(self, date): ...
available_slots.append((start_time, slot_end_time))
start_time += timedelta(minutes=60) return available_slots def get_upcoming_events(self, num_events): now = datetime.now() upcoming_events = [] for event in self.events: if event['start_time'] >= now: upcoming_events.append(event) ...
ClassEval_17
from datetime import datetime, timedelta class CalendarUtil: """ This is a class as CalendarUtil that provides functionalities to manage calendar events, schedule appointments, and perform conflict checks. """ def __init__(self): """ Initialize the calendar with an empty list of events...
import unittest from datetime import datetime class CalendarTestAddEvent(unittest.TestCase): def test_add_event(self): calendar = CalendarUtil() calendar.add_event({'date': datetime(2023, 1, 1, 0, 0), 'start_time': datetime(2023, 1, 1, 0, 0), 'end_time': datetime(2023, ...
from datetime import datetime, timedelta class CalendarUtil: def __init__(self): self.events = [] def add_event(self, event): self.events.append(event) def remove_event(self, event): if event in self.events: self.events.remove(event) def get_events(self, date): ...
[ "from datetime import datetime, timedelta" ]
""" This is a class as CalendarUtil that provides functionalities to manage calendar events, schedule appointments, and perform conflict checks. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.events" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_event(self, event):\n \"\"\"\n Add an event to the calendar.\n :param event: Th...
CalendarUtil
[ "CalendarTestAddEvent", "CalendarTestRemoveEvent", "CalendarTestGetEvents", "CalendarTestIsAvailable", "CalendarTestGetAvailableSlots", "CalendarTestGetUpcomingEvents", "CalendarTestMain" ]
class CalendarUtil: def __init__(self): """ Initialize the calendar with an empty list of events. """ self.events = []
[ "self.events" ]
ClassEval_17_t19
19
get_available_slots
def get_available_slots(self, date):
from datetime import datetime, timedelta class CalendarUtil: def __init__(self): self.events = [] def add_event(self, event): self.events.append(event) def remove_event(self, event): if event in self.events: self.events.remove(event) def get_events(self, date): ...
start_time += timedelta(minutes=60)
return available_slots def get_upcoming_events(self, num_events): now = datetime.now() upcoming_events = [] for event in self.events: if event['start_time'] >= now: upcoming_events.append(event) if len(upcoming_events) == num_events: ...
ClassEval_17
from datetime import datetime, timedelta class CalendarUtil: """ This is a class as CalendarUtil that provides functionalities to manage calendar events, schedule appointments, and perform conflict checks. """ def __init__(self): """ Initialize the calendar with an empty list of events...
import unittest from datetime import datetime class CalendarTestAddEvent(unittest.TestCase): def test_add_event(self): calendar = CalendarUtil() calendar.add_event({'date': datetime(2023, 1, 1, 0, 0), 'start_time': datetime(2023, 1, 1, 0, 0), 'end_time': datetime(2023, ...
from datetime import datetime, timedelta class CalendarUtil: def __init__(self): self.events = [] def add_event(self, event): self.events.append(event) def remove_event(self, event): if event in self.events: self.events.remove(event) def get_events(self, date): ...
[ "from datetime import datetime, timedelta" ]
""" This is a class as CalendarUtil that provides functionalities to manage calendar events, schedule appointments, and perform conflict checks. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.events" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_event(self, event):\n \"\"\"\n Add an event to the calendar.\n :param event: Th...
CalendarUtil
[ "CalendarTestAddEvent", "CalendarTestRemoveEvent", "CalendarTestGetEvents", "CalendarTestIsAvailable", "CalendarTestGetAvailableSlots", "CalendarTestGetUpcomingEvents", "CalendarTestMain" ]
class CalendarUtil: def __init__(self): """ Initialize the calendar with an empty list of events. """ self.events = []
[ "self.events" ]
ClassEval_17_t20
20
get_available_slots
def get_available_slots(self, date):
from datetime import datetime, timedelta class CalendarUtil: def __init__(self): self.events = [] def add_event(self, event): self.events.append(event) def remove_event(self, event): if event in self.events: self.events.remove(event) def get_events(self, date): ...
return available_slots
def get_upcoming_events(self, num_events): now = datetime.now() upcoming_events = [] for event in self.events: if event['start_time'] >= now: upcoming_events.append(event) if len(upcoming_events) == num_events: break return upc...
ClassEval_17
from datetime import datetime, timedelta class CalendarUtil: """ This is a class as CalendarUtil that provides functionalities to manage calendar events, schedule appointments, and perform conflict checks. """ def __init__(self): """ Initialize the calendar with an empty list of events...
import unittest from datetime import datetime class CalendarTestAddEvent(unittest.TestCase): def test_add_event(self): calendar = CalendarUtil() calendar.add_event({'date': datetime(2023, 1, 1, 0, 0), 'start_time': datetime(2023, 1, 1, 0, 0), 'end_time': datetime(2023, ...
from datetime import datetime, timedelta class CalendarUtil: def __init__(self): self.events = [] def add_event(self, event): self.events.append(event) def remove_event(self, event): if event in self.events: self.events.remove(event) def get_events(self, date): ...
[ "from datetime import datetime, timedelta" ]
""" This is a class as CalendarUtil that provides functionalities to manage calendar events, schedule appointments, and perform conflict checks. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.events" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_event(self, event):\n \"\"\"\n Add an event to the calendar.\n :param event: Th...
CalendarUtil
[ "CalendarTestAddEvent", "CalendarTestRemoveEvent", "CalendarTestGetEvents", "CalendarTestIsAvailable", "CalendarTestGetAvailableSlots", "CalendarTestGetUpcomingEvents", "CalendarTestMain" ]
class CalendarUtil: def __init__(self): """ Initialize the calendar with an empty list of events. """ self.events = []
[ "self.events" ]
ClassEval_17_t21
21
get_upcoming_events
def get_upcoming_events(self, num_events):
from datetime import datetime, timedelta class CalendarUtil: def __init__(self): self.events = [] def add_event(self, event): self.events.append(event) def remove_event(self, event): if event in self.events: self.events.remove(event) def get_events(self, date): ...
now = datetime.now()
upcoming_events = [] for event in self.events: if event['start_time'] >= now: upcoming_events.append(event) if len(upcoming_events) == num_events: break return upcoming_events
ClassEval_17
from datetime import datetime, timedelta class CalendarUtil: """ This is a class as CalendarUtil that provides functionalities to manage calendar events, schedule appointments, and perform conflict checks. """ def __init__(self): """ Initialize the calendar with an empty list of events...
import unittest from datetime import datetime class CalendarTestAddEvent(unittest.TestCase): def test_add_event(self): calendar = CalendarUtil() calendar.add_event({'date': datetime(2023, 1, 1, 0, 0), 'start_time': datetime(2023, 1, 1, 0, 0), 'end_time': datetime(2023, ...
from datetime import datetime, timedelta class CalendarUtil: def __init__(self): self.events = [] def add_event(self, event): self.events.append(event) def remove_event(self, event): if event in self.events: self.events.remove(event) def get_events(self, date): ...
[ "from datetime import datetime, timedelta" ]
""" This is a class as CalendarUtil that provides functionalities to manage calendar events, schedule appointments, and perform conflict checks. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.events" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_event(self, event):\n \"\"\"\n Add an event to the calendar.\n :param event: Th...
CalendarUtil
[ "CalendarTestAddEvent", "CalendarTestRemoveEvent", "CalendarTestGetEvents", "CalendarTestIsAvailable", "CalendarTestGetAvailableSlots", "CalendarTestGetUpcomingEvents", "CalendarTestMain" ]
class CalendarUtil: def __init__(self): """ Initialize the calendar with an empty list of events. """ self.events = []
[ "self.events" ]
ClassEval_17_t22
22
get_upcoming_events
def get_upcoming_events(self, num_events):
from datetime import datetime, timedelta class CalendarUtil: def __init__(self): self.events = [] def add_event(self, event): self.events.append(event) def remove_event(self, event): if event in self.events: self.events.remove(event) def get_events(self, date): ...
upcoming_events = []
for event in self.events: if event['start_time'] >= now: upcoming_events.append(event) if len(upcoming_events) == num_events: break return upcoming_events
ClassEval_17
from datetime import datetime, timedelta class CalendarUtil: """ This is a class as CalendarUtil that provides functionalities to manage calendar events, schedule appointments, and perform conflict checks. """ def __init__(self): """ Initialize the calendar with an empty list of events...
import unittest from datetime import datetime class CalendarTestAddEvent(unittest.TestCase): def test_add_event(self): calendar = CalendarUtil() calendar.add_event({'date': datetime(2023, 1, 1, 0, 0), 'start_time': datetime(2023, 1, 1, 0, 0), 'end_time': datetime(2023, ...
from datetime import datetime, timedelta class CalendarUtil: def __init__(self): self.events = [] def add_event(self, event): self.events.append(event) def remove_event(self, event): if event in self.events: self.events.remove(event) def get_events(self, date): ...
[ "from datetime import datetime, timedelta" ]
""" This is a class as CalendarUtil that provides functionalities to manage calendar events, schedule appointments, and perform conflict checks. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.events" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_event(self, event):\n \"\"\"\n Add an event to the calendar.\n :param event: Th...
CalendarUtil
[ "CalendarTestAddEvent", "CalendarTestRemoveEvent", "CalendarTestGetEvents", "CalendarTestIsAvailable", "CalendarTestGetAvailableSlots", "CalendarTestGetUpcomingEvents", "CalendarTestMain" ]
class CalendarUtil: def __init__(self): """ Initialize the calendar with an empty list of events. """ self.events = []
[ "self.events" ]
ClassEval_17_t23
23
get_upcoming_events
def get_upcoming_events(self, num_events):
from datetime import datetime, timedelta class CalendarUtil: def __init__(self): self.events = [] def add_event(self, event): self.events.append(event) def remove_event(self, event): if event in self.events: self.events.remove(event) def get_events(self, date): ...
for event in self.events:
if event['start_time'] >= now: upcoming_events.append(event) if len(upcoming_events) == num_events: break return upcoming_events
ClassEval_17
from datetime import datetime, timedelta class CalendarUtil: """ This is a class as CalendarUtil that provides functionalities to manage calendar events, schedule appointments, and perform conflict checks. """ def __init__(self): """ Initialize the calendar with an empty list of events...
import unittest from datetime import datetime class CalendarTestAddEvent(unittest.TestCase): def test_add_event(self): calendar = CalendarUtil() calendar.add_event({'date': datetime(2023, 1, 1, 0, 0), 'start_time': datetime(2023, 1, 1, 0, 0), 'end_time': datetime(2023, ...
from datetime import datetime, timedelta class CalendarUtil: def __init__(self): self.events = [] def add_event(self, event): self.events.append(event) def remove_event(self, event): if event in self.events: self.events.remove(event) def get_events(self, date): ...
[ "from datetime import datetime, timedelta" ]
""" This is a class as CalendarUtil that provides functionalities to manage calendar events, schedule appointments, and perform conflict checks. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.events" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_event(self, event):\n \"\"\"\n Add an event to the calendar.\n :param event: Th...
CalendarUtil
[ "CalendarTestAddEvent", "CalendarTestRemoveEvent", "CalendarTestGetEvents", "CalendarTestIsAvailable", "CalendarTestGetAvailableSlots", "CalendarTestGetUpcomingEvents", "CalendarTestMain" ]
class CalendarUtil: def __init__(self): """ Initialize the calendar with an empty list of events. """ self.events = []
[ "self.events" ]
ClassEval_17_t24
24
get_upcoming_events
def get_upcoming_events(self, num_events):
from datetime import datetime, timedelta class CalendarUtil: def __init__(self): self.events = [] def add_event(self, event): self.events.append(event) def remove_event(self, event): if event in self.events: self.events.remove(event) def get_events(self, date): ...
if event['start_time'] >= now:
upcoming_events.append(event) if len(upcoming_events) == num_events: break return upcoming_events
ClassEval_17
from datetime import datetime, timedelta class CalendarUtil: """ This is a class as CalendarUtil that provides functionalities to manage calendar events, schedule appointments, and perform conflict checks. """ def __init__(self): """ Initialize the calendar with an empty list of events...
import unittest from datetime import datetime class CalendarTestAddEvent(unittest.TestCase): def test_add_event(self): calendar = CalendarUtil() calendar.add_event({'date': datetime(2023, 1, 1, 0, 0), 'start_time': datetime(2023, 1, 1, 0, 0), 'end_time': datetime(2023, ...
from datetime import datetime, timedelta class CalendarUtil: def __init__(self): self.events = [] def add_event(self, event): self.events.append(event) def remove_event(self, event): if event in self.events: self.events.remove(event) def get_events(self, date): ...
[ "from datetime import datetime, timedelta" ]
""" This is a class as CalendarUtil that provides functionalities to manage calendar events, schedule appointments, and perform conflict checks. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.events" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_event(self, event):\n \"\"\"\n Add an event to the calendar.\n :param event: Th...
CalendarUtil
[ "CalendarTestAddEvent", "CalendarTestRemoveEvent", "CalendarTestGetEvents", "CalendarTestIsAvailable", "CalendarTestGetAvailableSlots", "CalendarTestGetUpcomingEvents", "CalendarTestMain" ]
class CalendarUtil: def __init__(self): """ Initialize the calendar with an empty list of events. """ self.events = []
[ "self.events" ]
ClassEval_17_t25
25
get_upcoming_events
def get_upcoming_events(self, num_events):
from datetime import datetime, timedelta class CalendarUtil: def __init__(self): self.events = [] def add_event(self, event): self.events.append(event) def remove_event(self, event): if event in self.events: self.events.remove(event) def get_events(self, date): ...
upcoming_events.append(event)
if len(upcoming_events) == num_events: break return upcoming_events
ClassEval_17
from datetime import datetime, timedelta class CalendarUtil: """ This is a class as CalendarUtil that provides functionalities to manage calendar events, schedule appointments, and perform conflict checks. """ def __init__(self): """ Initialize the calendar with an empty list of events...
import unittest from datetime import datetime class CalendarTestAddEvent(unittest.TestCase): def test_add_event(self): calendar = CalendarUtil() calendar.add_event({'date': datetime(2023, 1, 1, 0, 0), 'start_time': datetime(2023, 1, 1, 0, 0), 'end_time': datetime(2023, ...
from datetime import datetime, timedelta class CalendarUtil: def __init__(self): self.events = [] def add_event(self, event): self.events.append(event) def remove_event(self, event): if event in self.events: self.events.remove(event) def get_events(self, date): ...
[ "from datetime import datetime, timedelta" ]
""" This is a class as CalendarUtil that provides functionalities to manage calendar events, schedule appointments, and perform conflict checks. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.events" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_event(self, event):\n \"\"\"\n Add an event to the calendar.\n :param event: Th...
CalendarUtil
[ "CalendarTestAddEvent", "CalendarTestRemoveEvent", "CalendarTestGetEvents", "CalendarTestIsAvailable", "CalendarTestGetAvailableSlots", "CalendarTestGetUpcomingEvents", "CalendarTestMain" ]
class CalendarUtil: def __init__(self): """ Initialize the calendar with an empty list of events. """ self.events = []
[ "self.events" ]
ClassEval_17_t26
26
get_upcoming_events
def get_upcoming_events(self, num_events):
from datetime import datetime, timedelta class CalendarUtil: def __init__(self): self.events = [] def add_event(self, event): self.events.append(event) def remove_event(self, event): if event in self.events: self.events.remove(event) def get_events(self, date): ...
if len(upcoming_events) == num_events:
break return upcoming_events
ClassEval_17
from datetime import datetime, timedelta class CalendarUtil: """ This is a class as CalendarUtil that provides functionalities to manage calendar events, schedule appointments, and perform conflict checks. """ def __init__(self): """ Initialize the calendar with an empty list of events...
import unittest from datetime import datetime class CalendarTestAddEvent(unittest.TestCase): def test_add_event(self): calendar = CalendarUtil() calendar.add_event({'date': datetime(2023, 1, 1, 0, 0), 'start_time': datetime(2023, 1, 1, 0, 0), 'end_time': datetime(2023, ...
from datetime import datetime, timedelta class CalendarUtil: def __init__(self): self.events = [] def add_event(self, event): self.events.append(event) def remove_event(self, event): if event in self.events: self.events.remove(event) def get_events(self, date): ...
[ "from datetime import datetime, timedelta" ]
""" This is a class as CalendarUtil that provides functionalities to manage calendar events, schedule appointments, and perform conflict checks. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.events" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_event(self, event):\n \"\"\"\n Add an event to the calendar.\n :param event: Th...
CalendarUtil
[ "CalendarTestAddEvent", "CalendarTestRemoveEvent", "CalendarTestGetEvents", "CalendarTestIsAvailable", "CalendarTestGetAvailableSlots", "CalendarTestGetUpcomingEvents", "CalendarTestMain" ]
class CalendarUtil: def __init__(self): """ Initialize the calendar with an empty list of events. """ self.events = []
[ "self.events" ]
ClassEval_17_t27
27
get_upcoming_events
def get_upcoming_events(self, num_events):
from datetime import datetime, timedelta class CalendarUtil: def __init__(self): self.events = [] def add_event(self, event): self.events.append(event) def remove_event(self, event): if event in self.events: self.events.remove(event) def get_events(self, date): ...
break
return upcoming_events
ClassEval_17
from datetime import datetime, timedelta class CalendarUtil: """ This is a class as CalendarUtil that provides functionalities to manage calendar events, schedule appointments, and perform conflict checks. """ def __init__(self): """ Initialize the calendar with an empty list of events...
import unittest from datetime import datetime class CalendarTestAddEvent(unittest.TestCase): def test_add_event(self): calendar = CalendarUtil() calendar.add_event({'date': datetime(2023, 1, 1, 0, 0), 'start_time': datetime(2023, 1, 1, 0, 0), 'end_time': datetime(2023, ...
from datetime import datetime, timedelta class CalendarUtil: def __init__(self): self.events = [] def add_event(self, event): self.events.append(event) def remove_event(self, event): if event in self.events: self.events.remove(event) def get_events(self, date): ...
[ "from datetime import datetime, timedelta" ]
""" This is a class as CalendarUtil that provides functionalities to manage calendar events, schedule appointments, and perform conflict checks. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.events" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_event(self, event):\n \"\"\"\n Add an event to the calendar.\n :param event: Th...
CalendarUtil
[ "CalendarTestAddEvent", "CalendarTestRemoveEvent", "CalendarTestGetEvents", "CalendarTestIsAvailable", "CalendarTestGetAvailableSlots", "CalendarTestGetUpcomingEvents", "CalendarTestMain" ]
class CalendarUtil: def __init__(self): """ Initialize the calendar with an empty list of events. """ self.events = []
[ "self.events" ]
ClassEval_17_t28
28
get_upcoming_events
def get_upcoming_events(self, num_events):
from datetime import datetime, timedelta class CalendarUtil: def __init__(self): self.events = [] def add_event(self, event): self.events.append(event) def remove_event(self, event): if event in self.events: self.events.remove(event) def get_events(self, date): ...
return upcoming_events
ClassEval_18
class CamelCaseMap: """ This is a custom class that allows keys to be in camel case style by converting them from underscore style, which provides dictionary-like functionality. """ def __init__(self): """ Initialize data to an empty dictionary """ self._data = {} d...
import unittest class CamelCaseMapTestGetitem(unittest.TestCase): def test_getitem_1(self): camelize_map = CamelCaseMap() camelize_map['first_name'] = 'John' self.assertEqual(camelize_map.__getitem__('first_name'), 'John') def test_getitem_2(self): camelize_map = CamelCaseMap(...
class CamelCaseMap: def __init__(self): self._data = {} def __getitem__(self, key): return self._data[self._convert_key(key)] def __setitem__(self, key, value): self._data[self._convert_key(key)] = value def __delitem__(self, key): del self._data[self._convert_key(key)...
[]
""" This is a custom class that allows keys to be in camel case style by converting them from underscore style, which provides dictionary-like functionality. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self._data" ], "lib_dependencies": [], "method_dependencies": [ "_convert_key" ] }, "method_description": "def __getitem__(self, key):\n \"\"\"\n Return the value correspon...
CamelCaseMap
[ "CamelCaseMapTestGetitem", "CamelCaseMapTestSetitem", "CamelCaseMapTestDelitem", "CamelCaseMapTestIter", "CamelCaseMapTestLen", "CamelCaseMapTestConvertKey", "CamelCaseMapTestToCamelCase", "CamelCaseMapTest" ]
class CamelCaseMap: def __init__(self): """ Initialize data to an empty dictionary """ self._data = {}
[ "self._data" ]
ClassEval_18_t0
0
__getitem__
def __getitem__(self, key):
class CamelCaseMap: def __init__(self): self._data = {} def __getitem__(self, key):
return self._data[self._convert_key(key)]
def __setitem__(self, key, value): self._data[self._convert_key(key)] = value def __delitem__(self, key): del self._data[self._convert_key(key)] def __iter__(self): return iter(self._data) def __len__(self): return len(self._data) def _convert_key(self, key): ...
ClassEval_18
class CamelCaseMap: """ This is a custom class that allows keys to be in camel case style by converting them from underscore style, which provides dictionary-like functionality. """ def __init__(self): """ Initialize data to an empty dictionary """ self._data = {} d...
import unittest class CamelCaseMapTestGetitem(unittest.TestCase): def test_getitem_1(self): camelize_map = CamelCaseMap() camelize_map['first_name'] = 'John' self.assertEqual(camelize_map.__getitem__('first_name'), 'John') def test_getitem_2(self): camelize_map = CamelCaseMap(...
class CamelCaseMap: def __init__(self): self._data = {} def __getitem__(self, key): return self._data[self._convert_key(key)] def __setitem__(self, key, value): self._data[self._convert_key(key)] = value def __delitem__(self, key): del self._data[self._convert_key(key)...
[]
""" This is a custom class that allows keys to be in camel case style by converting them from underscore style, which provides dictionary-like functionality. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self._data" ], "lib_dependencies": [], "method_dependencies": [ "_convert_key" ] }, "method_description": "def __getitem__(self, key):\n \"\"\"\n Return the value correspon...
CamelCaseMap
[ "CamelCaseMapTestGetitem", "CamelCaseMapTestSetitem", "CamelCaseMapTestDelitem", "CamelCaseMapTestIter", "CamelCaseMapTestLen", "CamelCaseMapTestConvertKey", "CamelCaseMapTestToCamelCase", "CamelCaseMapTest" ]
class CamelCaseMap: def __init__(self): """ Initialize data to an empty dictionary """ self._data = {}
[ "self._data" ]
ClassEval_18_t1
1
__setitem__
def __setitem__(self, key, value):
class CamelCaseMap: def __init__(self): self._data = {} def __getitem__(self, key): return self._data[self._convert_key(key)] def __setitem__(self, key, value):
self._data[self._convert_key(key)] = value
def __delitem__(self, key): del self._data[self._convert_key(key)] def __iter__(self): return iter(self._data) def __len__(self): return len(self._data) def _convert_key(self, key): if isinstance(key, str): return self._to_camel_case(key) return ke...
ClassEval_18
class CamelCaseMap: """ This is a custom class that allows keys to be in camel case style by converting them from underscore style, which provides dictionary-like functionality. """ def __init__(self): """ Initialize data to an empty dictionary """ self._data = {} d...
import unittest class CamelCaseMapTestGetitem(unittest.TestCase): def test_getitem_1(self): camelize_map = CamelCaseMap() camelize_map['first_name'] = 'John' self.assertEqual(camelize_map.__getitem__('first_name'), 'John') def test_getitem_2(self): camelize_map = CamelCaseMap(...
class CamelCaseMap: def __init__(self): self._data = {} def __getitem__(self, key): return self._data[self._convert_key(key)] def __setitem__(self, key, value): self._data[self._convert_key(key)] = value def __delitem__(self, key): del self._data[self._convert_key(key)...
[]
""" This is a custom class that allows keys to be in camel case style by converting them from underscore style, which provides dictionary-like functionality. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self._data" ], "lib_dependencies": [], "method_dependencies": [ "_convert_key" ] }, "method_description": "def __getitem__(self, key):\n \"\"\"\n Return the value correspon...
CamelCaseMap
[ "CamelCaseMapTestGetitem", "CamelCaseMapTestSetitem", "CamelCaseMapTestDelitem", "CamelCaseMapTestIter", "CamelCaseMapTestLen", "CamelCaseMapTestConvertKey", "CamelCaseMapTestToCamelCase", "CamelCaseMapTest" ]
class CamelCaseMap: def __init__(self): """ Initialize data to an empty dictionary """ self._data = {}
[ "self._data" ]
ClassEval_18_t2
2
__delitem__
def __delitem__(self, key):
class CamelCaseMap: def __init__(self): self._data = {} def __getitem__(self, key): return self._data[self._convert_key(key)] def __setitem__(self, key, value): self._data[self._convert_key(key)] = value def __delitem__(self, key):
del self._data[self._convert_key(key)]
def __iter__(self): return iter(self._data) def __len__(self): return len(self._data) def _convert_key(self, key): if isinstance(key, str): return self._to_camel_case(key) return key @staticmethod def _to_camel_case(key): parts = key.split('_')...
ClassEval_18
class CamelCaseMap: """ This is a custom class that allows keys to be in camel case style by converting them from underscore style, which provides dictionary-like functionality. """ def __init__(self): """ Initialize data to an empty dictionary """ self._data = {} d...
import unittest class CamelCaseMapTestGetitem(unittest.TestCase): def test_getitem_1(self): camelize_map = CamelCaseMap() camelize_map['first_name'] = 'John' self.assertEqual(camelize_map.__getitem__('first_name'), 'John') def test_getitem_2(self): camelize_map = CamelCaseMap(...
class CamelCaseMap: def __init__(self): self._data = {} def __getitem__(self, key): return self._data[self._convert_key(key)] def __setitem__(self, key, value): self._data[self._convert_key(key)] = value def __delitem__(self, key): del self._data[self._convert_key(key)...
[]
""" This is a custom class that allows keys to be in camel case style by converting them from underscore style, which provides dictionary-like functionality. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self._data" ], "lib_dependencies": [], "method_dependencies": [ "_convert_key" ] }, "method_description": "def __getitem__(self, key):\n \"\"\"\n Return the value correspon...
CamelCaseMap
[ "CamelCaseMapTestGetitem", "CamelCaseMapTestSetitem", "CamelCaseMapTestDelitem", "CamelCaseMapTestIter", "CamelCaseMapTestLen", "CamelCaseMapTestConvertKey", "CamelCaseMapTestToCamelCase", "CamelCaseMapTest" ]
class CamelCaseMap: def __init__(self): """ Initialize data to an empty dictionary """ self._data = {}
[ "self._data" ]
ClassEval_18_t3
3
__iter__
def __iter__(self):
class CamelCaseMap: def __init__(self): self._data = {} def __getitem__(self, key): return self._data[self._convert_key(key)] def __setitem__(self, key, value): self._data[self._convert_key(key)] = value def __delitem__(self, key): del self._data[self._convert_key(key)...
return iter(self._data)
def __len__(self): return len(self._data) def _convert_key(self, key): if isinstance(key, str): return self._to_camel_case(key) return key @staticmethod def _to_camel_case(key): parts = key.split('_') return parts[0] + ''.join(part.title() for part ...
ClassEval_18
class CamelCaseMap: """ This is a custom class that allows keys to be in camel case style by converting them from underscore style, which provides dictionary-like functionality. """ def __init__(self): """ Initialize data to an empty dictionary """ self._data = {} d...
import unittest class CamelCaseMapTestGetitem(unittest.TestCase): def test_getitem_1(self): camelize_map = CamelCaseMap() camelize_map['first_name'] = 'John' self.assertEqual(camelize_map.__getitem__('first_name'), 'John') def test_getitem_2(self): camelize_map = CamelCaseMap(...
class CamelCaseMap: def __init__(self): self._data = {} def __getitem__(self, key): return self._data[self._convert_key(key)] def __setitem__(self, key, value): self._data[self._convert_key(key)] = value def __delitem__(self, key): del self._data[self._convert_key(key)...
[]
""" This is a custom class that allows keys to be in camel case style by converting them from underscore style, which provides dictionary-like functionality. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self._data" ], "lib_dependencies": [], "method_dependencies": [ "_convert_key" ] }, "method_description": "def __getitem__(self, key):\n \"\"\"\n Return the value correspon...
CamelCaseMap
[ "CamelCaseMapTestGetitem", "CamelCaseMapTestSetitem", "CamelCaseMapTestDelitem", "CamelCaseMapTestIter", "CamelCaseMapTestLen", "CamelCaseMapTestConvertKey", "CamelCaseMapTestToCamelCase", "CamelCaseMapTest" ]
class CamelCaseMap: def __init__(self): """ Initialize data to an empty dictionary """ self._data = {}
[ "self._data" ]
ClassEval_18_t4
4
__len__
def __len__(self):
class CamelCaseMap: def __init__(self): self._data = {} def __getitem__(self, key): return self._data[self._convert_key(key)] def __setitem__(self, key, value): self._data[self._convert_key(key)] = value def __delitem__(self, key): del self._data[self._convert_key(key)...
return len(self._data)
def _convert_key(self, key): if isinstance(key, str): return self._to_camel_case(key) return key @staticmethod def _to_camel_case(key): parts = key.split('_') return parts[0] + ''.join(part.title() for part in parts[1:])
ClassEval_18
class CamelCaseMap: """ This is a custom class that allows keys to be in camel case style by converting them from underscore style, which provides dictionary-like functionality. """ def __init__(self): """ Initialize data to an empty dictionary """ self._data = {} d...
import unittest class CamelCaseMapTestGetitem(unittest.TestCase): def test_getitem_1(self): camelize_map = CamelCaseMap() camelize_map['first_name'] = 'John' self.assertEqual(camelize_map.__getitem__('first_name'), 'John') def test_getitem_2(self): camelize_map = CamelCaseMap(...
class CamelCaseMap: def __init__(self): self._data = {} def __getitem__(self, key): return self._data[self._convert_key(key)] def __setitem__(self, key, value): self._data[self._convert_key(key)] = value def __delitem__(self, key): del self._data[self._convert_key(key)...
[]
""" This is a custom class that allows keys to be in camel case style by converting them from underscore style, which provides dictionary-like functionality. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self._data" ], "lib_dependencies": [], "method_dependencies": [ "_convert_key" ] }, "method_description": "def __getitem__(self, key):\n \"\"\"\n Return the value correspon...
CamelCaseMap
[ "CamelCaseMapTestGetitem", "CamelCaseMapTestSetitem", "CamelCaseMapTestDelitem", "CamelCaseMapTestIter", "CamelCaseMapTestLen", "CamelCaseMapTestConvertKey", "CamelCaseMapTestToCamelCase", "CamelCaseMapTest" ]
class CamelCaseMap: def __init__(self): """ Initialize data to an empty dictionary """ self._data = {}
[ "self._data" ]
ClassEval_18_t5
5
_convert_key
def _convert_key(self, key):
class CamelCaseMap: def __init__(self): self._data = {} def __getitem__(self, key): return self._data[self._convert_key(key)] def __setitem__(self, key, value): self._data[self._convert_key(key)] = value def __delitem__(self, key): del self._data[self._convert_key(key)...
if isinstance(key, str):
return self._to_camel_case(key) return key @staticmethod def _to_camel_case(key): parts = key.split('_') return parts[0] + ''.join(part.title() for part in parts[1:])
ClassEval_18
class CamelCaseMap: """ This is a custom class that allows keys to be in camel case style by converting them from underscore style, which provides dictionary-like functionality. """ def __init__(self): """ Initialize data to an empty dictionary """ self._data = {} d...
import unittest class CamelCaseMapTestGetitem(unittest.TestCase): def test_getitem_1(self): camelize_map = CamelCaseMap() camelize_map['first_name'] = 'John' self.assertEqual(camelize_map.__getitem__('first_name'), 'John') def test_getitem_2(self): camelize_map = CamelCaseMap(...
class CamelCaseMap: def __init__(self): self._data = {} def __getitem__(self, key): return self._data[self._convert_key(key)] def __setitem__(self, key, value): self._data[self._convert_key(key)] = value def __delitem__(self, key): del self._data[self._convert_key(key)...
[]
""" This is a custom class that allows keys to be in camel case style by converting them from underscore style, which provides dictionary-like functionality. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self._data" ], "lib_dependencies": [], "method_dependencies": [ "_convert_key" ] }, "method_description": "def __getitem__(self, key):\n \"\"\"\n Return the value correspon...
CamelCaseMap
[ "CamelCaseMapTestGetitem", "CamelCaseMapTestSetitem", "CamelCaseMapTestDelitem", "CamelCaseMapTestIter", "CamelCaseMapTestLen", "CamelCaseMapTestConvertKey", "CamelCaseMapTestToCamelCase", "CamelCaseMapTest" ]
class CamelCaseMap: def __init__(self): """ Initialize data to an empty dictionary """ self._data = {}
[ "self._data" ]
ClassEval_18_t6
6
_convert_key
def _convert_key(self, key):
class CamelCaseMap: def __init__(self): self._data = {} def __getitem__(self, key): return self._data[self._convert_key(key)] def __setitem__(self, key, value): self._data[self._convert_key(key)] = value def __delitem__(self, key): del self._data[self._convert_key(key)...
return self._to_camel_case(key)
return key @staticmethod def _to_camel_case(key): parts = key.split('_') return parts[0] + ''.join(part.title() for part in parts[1:])
ClassEval_18
class CamelCaseMap: """ This is a custom class that allows keys to be in camel case style by converting them from underscore style, which provides dictionary-like functionality. """ def __init__(self): """ Initialize data to an empty dictionary """ self._data = {} d...
import unittest class CamelCaseMapTestGetitem(unittest.TestCase): def test_getitem_1(self): camelize_map = CamelCaseMap() camelize_map['first_name'] = 'John' self.assertEqual(camelize_map.__getitem__('first_name'), 'John') def test_getitem_2(self): camelize_map = CamelCaseMap(...
class CamelCaseMap: def __init__(self): self._data = {} def __getitem__(self, key): return self._data[self._convert_key(key)] def __setitem__(self, key, value): self._data[self._convert_key(key)] = value def __delitem__(self, key): del self._data[self._convert_key(key)...
[]
""" This is a custom class that allows keys to be in camel case style by converting them from underscore style, which provides dictionary-like functionality. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self._data" ], "lib_dependencies": [], "method_dependencies": [ "_convert_key" ] }, "method_description": "def __getitem__(self, key):\n \"\"\"\n Return the value correspon...
CamelCaseMap
[ "CamelCaseMapTestGetitem", "CamelCaseMapTestSetitem", "CamelCaseMapTestDelitem", "CamelCaseMapTestIter", "CamelCaseMapTestLen", "CamelCaseMapTestConvertKey", "CamelCaseMapTestToCamelCase", "CamelCaseMapTest" ]
class CamelCaseMap: def __init__(self): """ Initialize data to an empty dictionary """ self._data = {}
[ "self._data" ]
ClassEval_18_t7
7
_convert_key
def _convert_key(self, key):
class CamelCaseMap: def __init__(self): self._data = {} def __getitem__(self, key): return self._data[self._convert_key(key)] def __setitem__(self, key, value): self._data[self._convert_key(key)] = value def __delitem__(self, key): del self._data[self._convert_key(key)...
return key
@staticmethod def _to_camel_case(key): parts = key.split('_') return parts[0] + ''.join(part.title() for part in parts[1:])
ClassEval_18
class CamelCaseMap: """ This is a custom class that allows keys to be in camel case style by converting them from underscore style, which provides dictionary-like functionality. """ def __init__(self): """ Initialize data to an empty dictionary """ self._data = {} d...
import unittest class CamelCaseMapTestGetitem(unittest.TestCase): def test_getitem_1(self): camelize_map = CamelCaseMap() camelize_map['first_name'] = 'John' self.assertEqual(camelize_map.__getitem__('first_name'), 'John') def test_getitem_2(self): camelize_map = CamelCaseMap(...
class CamelCaseMap: def __init__(self): self._data = {} def __getitem__(self, key): return self._data[self._convert_key(key)] def __setitem__(self, key, value): self._data[self._convert_key(key)] = value def __delitem__(self, key): del self._data[self._convert_key(key)...
[]
""" This is a custom class that allows keys to be in camel case style by converting them from underscore style, which provides dictionary-like functionality. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self._data" ], "lib_dependencies": [], "method_dependencies": [ "_convert_key" ] }, "method_description": "def __getitem__(self, key):\n \"\"\"\n Return the value correspon...
CamelCaseMap
[ "CamelCaseMapTestGetitem", "CamelCaseMapTestSetitem", "CamelCaseMapTestDelitem", "CamelCaseMapTestIter", "CamelCaseMapTestLen", "CamelCaseMapTestConvertKey", "CamelCaseMapTestToCamelCase", "CamelCaseMapTest" ]
class CamelCaseMap: def __init__(self): """ Initialize data to an empty dictionary """ self._data = {}
[ "self._data" ]
ClassEval_18_t8
8
_to_camel_case
def _to_camel_case(key):
class CamelCaseMap: def __init__(self): self._data = {} def __getitem__(self, key): return self._data[self._convert_key(key)] def __setitem__(self, key, value): self._data[self._convert_key(key)] = value def __delitem__(self, key): del self._data[self._convert_key(key)...
parts = key.split('_')
return parts[0] + ''.join(part.title() for part in parts[1:])
ClassEval_18
class CamelCaseMap: """ This is a custom class that allows keys to be in camel case style by converting them from underscore style, which provides dictionary-like functionality. """ def __init__(self): """ Initialize data to an empty dictionary """ self._data = {} d...
import unittest class CamelCaseMapTestGetitem(unittest.TestCase): def test_getitem_1(self): camelize_map = CamelCaseMap() camelize_map['first_name'] = 'John' self.assertEqual(camelize_map.__getitem__('first_name'), 'John') def test_getitem_2(self): camelize_map = CamelCaseMap(...
class CamelCaseMap: def __init__(self): self._data = {} def __getitem__(self, key): return self._data[self._convert_key(key)] def __setitem__(self, key, value): self._data[self._convert_key(key)] = value def __delitem__(self, key): del self._data[self._convert_key(key)...
[]
""" This is a custom class that allows keys to be in camel case style by converting them from underscore style, which provides dictionary-like functionality. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self._data" ], "lib_dependencies": [], "method_dependencies": [ "_convert_key" ] }, "method_description": "def __getitem__(self, key):\n \"\"\"\n Return the value correspon...
CamelCaseMap
[ "CamelCaseMapTestGetitem", "CamelCaseMapTestSetitem", "CamelCaseMapTestDelitem", "CamelCaseMapTestIter", "CamelCaseMapTestLen", "CamelCaseMapTestConvertKey", "CamelCaseMapTestToCamelCase", "CamelCaseMapTest" ]
class CamelCaseMap: def __init__(self): """ Initialize data to an empty dictionary """ self._data = {}
[ "self._data" ]
ClassEval_18_t9
9
_to_camel_case
def _to_camel_case(key):
class CamelCaseMap: def __init__(self): self._data = {} def __getitem__(self, key): return self._data[self._convert_key(key)] def __setitem__(self, key, value): self._data[self._convert_key(key)] = value def __delitem__(self, key): del self._data[self._convert_key(key)...
return parts[0] + ''.join(part.title() for part in parts[1:])
ClassEval_19
class ChandrasekharSieve: """ This is a class that uses the Chandrasekhar's Sieve method to find all prime numbers within the range """ def __init__(self, n): """ Initialize the ChandrasekharSieve class with the given limit. :param n: int, the upper limit for generating prime nu...
import unittest class ChandrasekharSieveTestGeneratePrimes(unittest.TestCase): def test_generate_primes_1(self): cs = ChandrasekharSieve(20) res = cs.generate_primes() self.assertEqual(res, [2, 3, 5, 7, 11, 13, 17, 19]) def test_generate_primes_2(self): cs = ChandrasekharSieve...
class ChandrasekharSieve: def __init__(self, n): self.n = n self.primes = self.generate_primes() def generate_primes(self): if self.n < 2: return [] sieve = [True] * (self.n + 1) sieve[0] = sieve[1] = False p = 2 while p * p <= self.n: ...
[]
""" This is a class that uses the Chandrasekhar's Sieve method to find all prime numbers within the range """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.n" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def generate_primes(self):\n \"\"\"\n Generate prime numbers up to the specified limit using the Ch...
ChandrasekharSieve
[ "ChandrasekharSieveTestGeneratePrimes", "ChandrasekharSieveTestGetPrimes", "ChandrasekharSieveTest" ]
class ChandrasekharSieve: def __init__(self, n): """ Initialize the ChandrasekharSieve class with the given limit. :param n: int, the upper limit for generating prime numbers """ self.n = n self.primes = self.generate_primes()
[ "self.n", "self.primes" ]
ClassEval_19_t0
0
generate_primes
def generate_primes(self):
class ChandrasekharSieve: def __init__(self, n): self.n = n self.primes = self.generate_primes() def generate_primes(self):
if self.n < 2:
return [] sieve = [True] * (self.n + 1) sieve[0] = sieve[1] = False p = 2 while p * p <= self.n: if sieve[p]: for i in range(p * p, self.n + 1, p): sieve[i] = False p += 1 primes = [] for i in rang...
ClassEval_19
class ChandrasekharSieve: """ This is a class that uses the Chandrasekhar's Sieve method to find all prime numbers within the range """ def __init__(self, n): """ Initialize the ChandrasekharSieve class with the given limit. :param n: int, the upper limit for generating prime nu...
import unittest class ChandrasekharSieveTestGeneratePrimes(unittest.TestCase): def test_generate_primes_1(self): cs = ChandrasekharSieve(20) res = cs.generate_primes() self.assertEqual(res, [2, 3, 5, 7, 11, 13, 17, 19]) def test_generate_primes_2(self): cs = ChandrasekharSieve...
class ChandrasekharSieve: def __init__(self, n): self.n = n self.primes = self.generate_primes() def generate_primes(self): if self.n < 2: return [] sieve = [True] * (self.n + 1) sieve[0] = sieve[1] = False p = 2 while p * p <= self.n: ...
[]
""" This is a class that uses the Chandrasekhar's Sieve method to find all prime numbers within the range """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.n" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def generate_primes(self):\n \"\"\"\n Generate prime numbers up to the specified limit using the Ch...
ChandrasekharSieve
[ "ChandrasekharSieveTestGeneratePrimes", "ChandrasekharSieveTestGetPrimes", "ChandrasekharSieveTest" ]
class ChandrasekharSieve: def __init__(self, n): """ Initialize the ChandrasekharSieve class with the given limit. :param n: int, the upper limit for generating prime numbers """ self.n = n self.primes = self.generate_primes()
[ "self.n", "self.primes" ]
ClassEval_19_t1
1
generate_primes
def generate_primes(self):
class ChandrasekharSieve: def __init__(self, n): self.n = n self.primes = self.generate_primes() def generate_primes(self): if self.n < 2:
return []
sieve = [True] * (self.n + 1) sieve[0] = sieve[1] = False p = 2 while p * p <= self.n: if sieve[p]: for i in range(p * p, self.n + 1, p): sieve[i] = False p += 1 primes = [] for i in range(2, self.n + 1): ...
ClassEval_19
class ChandrasekharSieve: """ This is a class that uses the Chandrasekhar's Sieve method to find all prime numbers within the range """ def __init__(self, n): """ Initialize the ChandrasekharSieve class with the given limit. :param n: int, the upper limit for generating prime nu...
import unittest class ChandrasekharSieveTestGeneratePrimes(unittest.TestCase): def test_generate_primes_1(self): cs = ChandrasekharSieve(20) res = cs.generate_primes() self.assertEqual(res, [2, 3, 5, 7, 11, 13, 17, 19]) def test_generate_primes_2(self): cs = ChandrasekharSieve...
class ChandrasekharSieve: def __init__(self, n): self.n = n self.primes = self.generate_primes() def generate_primes(self): if self.n < 2: return [] sieve = [True] * (self.n + 1) sieve[0] = sieve[1] = False p = 2 while p * p <= self.n: ...
[]
""" This is a class that uses the Chandrasekhar's Sieve method to find all prime numbers within the range """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.n" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def generate_primes(self):\n \"\"\"\n Generate prime numbers up to the specified limit using the Ch...
ChandrasekharSieve
[ "ChandrasekharSieveTestGeneratePrimes", "ChandrasekharSieveTestGetPrimes", "ChandrasekharSieveTest" ]
class ChandrasekharSieve: def __init__(self, n): """ Initialize the ChandrasekharSieve class with the given limit. :param n: int, the upper limit for generating prime numbers """ self.n = n self.primes = self.generate_primes()
[ "self.n", "self.primes" ]
ClassEval_19_t2
2
generate_primes
def generate_primes(self):
class ChandrasekharSieve: def __init__(self, n): self.n = n self.primes = self.generate_primes() def generate_primes(self): if self.n < 2: return []
sieve = [True] * (self.n + 1)
sieve[0] = sieve[1] = False p = 2 while p * p <= self.n: if sieve[p]: for i in range(p * p, self.n + 1, p): sieve[i] = False p += 1 primes = [] for i in range(2, self.n + 1): if sieve[i]: pr...
ClassEval_19
class ChandrasekharSieve: """ This is a class that uses the Chandrasekhar's Sieve method to find all prime numbers within the range """ def __init__(self, n): """ Initialize the ChandrasekharSieve class with the given limit. :param n: int, the upper limit for generating prime nu...
import unittest class ChandrasekharSieveTestGeneratePrimes(unittest.TestCase): def test_generate_primes_1(self): cs = ChandrasekharSieve(20) res = cs.generate_primes() self.assertEqual(res, [2, 3, 5, 7, 11, 13, 17, 19]) def test_generate_primes_2(self): cs = ChandrasekharSieve...
class ChandrasekharSieve: def __init__(self, n): self.n = n self.primes = self.generate_primes() def generate_primes(self): if self.n < 2: return [] sieve = [True] * (self.n + 1) sieve[0] = sieve[1] = False p = 2 while p * p <= self.n: ...
[]
""" This is a class that uses the Chandrasekhar's Sieve method to find all prime numbers within the range """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.n" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def generate_primes(self):\n \"\"\"\n Generate prime numbers up to the specified limit using the Ch...
ChandrasekharSieve
[ "ChandrasekharSieveTestGeneratePrimes", "ChandrasekharSieveTestGetPrimes", "ChandrasekharSieveTest" ]
class ChandrasekharSieve: def __init__(self, n): """ Initialize the ChandrasekharSieve class with the given limit. :param n: int, the upper limit for generating prime numbers """ self.n = n self.primes = self.generate_primes()
[ "self.n", "self.primes" ]
ClassEval_19_t3
3
generate_primes
def generate_primes(self):
class ChandrasekharSieve: def __init__(self, n): self.n = n self.primes = self.generate_primes() def generate_primes(self): if self.n < 2: return [] sieve = [True] * (self.n + 1)
sieve[0] = sieve[1] = False
p = 2 while p * p <= self.n: if sieve[p]: for i in range(p * p, self.n + 1, p): sieve[i] = False p += 1 primes = [] for i in range(2, self.n + 1): if sieve[i]: primes.append(i) return prime...
ClassEval_19
class ChandrasekharSieve: """ This is a class that uses the Chandrasekhar's Sieve method to find all prime numbers within the range """ def __init__(self, n): """ Initialize the ChandrasekharSieve class with the given limit. :param n: int, the upper limit for generating prime nu...
import unittest class ChandrasekharSieveTestGeneratePrimes(unittest.TestCase): def test_generate_primes_1(self): cs = ChandrasekharSieve(20) res = cs.generate_primes() self.assertEqual(res, [2, 3, 5, 7, 11, 13, 17, 19]) def test_generate_primes_2(self): cs = ChandrasekharSieve...
class ChandrasekharSieve: def __init__(self, n): self.n = n self.primes = self.generate_primes() def generate_primes(self): if self.n < 2: return [] sieve = [True] * (self.n + 1) sieve[0] = sieve[1] = False p = 2 while p * p <= self.n: ...
[]
""" This is a class that uses the Chandrasekhar's Sieve method to find all prime numbers within the range """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.n" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def generate_primes(self):\n \"\"\"\n Generate prime numbers up to the specified limit using the Ch...
ChandrasekharSieve
[ "ChandrasekharSieveTestGeneratePrimes", "ChandrasekharSieveTestGetPrimes", "ChandrasekharSieveTest" ]
class ChandrasekharSieve: def __init__(self, n): """ Initialize the ChandrasekharSieve class with the given limit. :param n: int, the upper limit for generating prime numbers """ self.n = n self.primes = self.generate_primes()
[ "self.n", "self.primes" ]
ClassEval_19_t4
4
generate_primes
def generate_primes(self):
class ChandrasekharSieve: def __init__(self, n): self.n = n self.primes = self.generate_primes() def generate_primes(self): if self.n < 2: return [] sieve = [True] * (self.n + 1) sieve[0] = sieve[1] = False
p = 2
while p * p <= self.n: if sieve[p]: for i in range(p * p, self.n + 1, p): sieve[i] = False p += 1 primes = [] for i in range(2, self.n + 1): if sieve[i]: primes.append(i) return primes def get_...
ClassEval_19
class ChandrasekharSieve: """ This is a class that uses the Chandrasekhar's Sieve method to find all prime numbers within the range """ def __init__(self, n): """ Initialize the ChandrasekharSieve class with the given limit. :param n: int, the upper limit for generating prime nu...
import unittest class ChandrasekharSieveTestGeneratePrimes(unittest.TestCase): def test_generate_primes_1(self): cs = ChandrasekharSieve(20) res = cs.generate_primes() self.assertEqual(res, [2, 3, 5, 7, 11, 13, 17, 19]) def test_generate_primes_2(self): cs = ChandrasekharSieve...
class ChandrasekharSieve: def __init__(self, n): self.n = n self.primes = self.generate_primes() def generate_primes(self): if self.n < 2: return [] sieve = [True] * (self.n + 1) sieve[0] = sieve[1] = False p = 2 while p * p <= self.n: ...
[]
""" This is a class that uses the Chandrasekhar's Sieve method to find all prime numbers within the range """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.n" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def generate_primes(self):\n \"\"\"\n Generate prime numbers up to the specified limit using the Ch...
ChandrasekharSieve
[ "ChandrasekharSieveTestGeneratePrimes", "ChandrasekharSieveTestGetPrimes", "ChandrasekharSieveTest" ]
class ChandrasekharSieve: def __init__(self, n): """ Initialize the ChandrasekharSieve class with the given limit. :param n: int, the upper limit for generating prime numbers """ self.n = n self.primes = self.generate_primes()
[ "self.n", "self.primes" ]
ClassEval_19_t5
5
generate_primes
def generate_primes(self):
class ChandrasekharSieve: def __init__(self, n): self.n = n self.primes = self.generate_primes() def generate_primes(self): if self.n < 2: return [] sieve = [True] * (self.n + 1) sieve[0] = sieve[1] = False p = 2
while p * p <= self.n:
if sieve[p]: for i in range(p * p, self.n + 1, p): sieve[i] = False p += 1 primes = [] for i in range(2, self.n + 1): if sieve[i]: primes.append(i) return primes def get_primes(self): return se...
ClassEval_19
class ChandrasekharSieve: """ This is a class that uses the Chandrasekhar's Sieve method to find all prime numbers within the range """ def __init__(self, n): """ Initialize the ChandrasekharSieve class with the given limit. :param n: int, the upper limit for generating prime nu...
import unittest class ChandrasekharSieveTestGeneratePrimes(unittest.TestCase): def test_generate_primes_1(self): cs = ChandrasekharSieve(20) res = cs.generate_primes() self.assertEqual(res, [2, 3, 5, 7, 11, 13, 17, 19]) def test_generate_primes_2(self): cs = ChandrasekharSieve...
class ChandrasekharSieve: def __init__(self, n): self.n = n self.primes = self.generate_primes() def generate_primes(self): if self.n < 2: return [] sieve = [True] * (self.n + 1) sieve[0] = sieve[1] = False p = 2 while p * p <= self.n: ...
[]
""" This is a class that uses the Chandrasekhar's Sieve method to find all prime numbers within the range """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.n" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def generate_primes(self):\n \"\"\"\n Generate prime numbers up to the specified limit using the Ch...
ChandrasekharSieve
[ "ChandrasekharSieveTestGeneratePrimes", "ChandrasekharSieveTestGetPrimes", "ChandrasekharSieveTest" ]
class ChandrasekharSieve: def __init__(self, n): """ Initialize the ChandrasekharSieve class with the given limit. :param n: int, the upper limit for generating prime numbers """ self.n = n self.primes = self.generate_primes()
[ "self.n", "self.primes" ]
ClassEval_19_t6
6
generate_primes
def generate_primes(self):
class ChandrasekharSieve: def __init__(self, n): self.n = n self.primes = self.generate_primes() def generate_primes(self): if self.n < 2: return [] sieve = [True] * (self.n + 1) sieve[0] = sieve[1] = False p = 2 while p * p <= self.n:
if sieve[p]:
for i in range(p * p, self.n + 1, p): sieve[i] = False p += 1 primes = [] for i in range(2, self.n + 1): if sieve[i]: primes.append(i) return primes def get_primes(self): return self.primes
ClassEval_19
class ChandrasekharSieve: """ This is a class that uses the Chandrasekhar's Sieve method to find all prime numbers within the range """ def __init__(self, n): """ Initialize the ChandrasekharSieve class with the given limit. :param n: int, the upper limit for generating prime nu...
import unittest class ChandrasekharSieveTestGeneratePrimes(unittest.TestCase): def test_generate_primes_1(self): cs = ChandrasekharSieve(20) res = cs.generate_primes() self.assertEqual(res, [2, 3, 5, 7, 11, 13, 17, 19]) def test_generate_primes_2(self): cs = ChandrasekharSieve...
class ChandrasekharSieve: def __init__(self, n): self.n = n self.primes = self.generate_primes() def generate_primes(self): if self.n < 2: return [] sieve = [True] * (self.n + 1) sieve[0] = sieve[1] = False p = 2 while p * p <= self.n: ...
[]
""" This is a class that uses the Chandrasekhar's Sieve method to find all prime numbers within the range """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.n" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def generate_primes(self):\n \"\"\"\n Generate prime numbers up to the specified limit using the Ch...
ChandrasekharSieve
[ "ChandrasekharSieveTestGeneratePrimes", "ChandrasekharSieveTestGetPrimes", "ChandrasekharSieveTest" ]
class ChandrasekharSieve: def __init__(self, n): """ Initialize the ChandrasekharSieve class with the given limit. :param n: int, the upper limit for generating prime numbers """ self.n = n self.primes = self.generate_primes()
[ "self.n", "self.primes" ]
ClassEval_19_t7
7
generate_primes
def generate_primes(self):
class ChandrasekharSieve: def __init__(self, n): self.n = n self.primes = self.generate_primes() def generate_primes(self): if self.n < 2: return [] sieve = [True] * (self.n + 1) sieve[0] = sieve[1] = False p = 2 while p * p <= self.n: ...
for i in range(p * p, self.n + 1, p):
sieve[i] = False p += 1 primes = [] for i in range(2, self.n + 1): if sieve[i]: primes.append(i) return primes def get_primes(self): return self.primes
ClassEval_19
class ChandrasekharSieve: """ This is a class that uses the Chandrasekhar's Sieve method to find all prime numbers within the range """ def __init__(self, n): """ Initialize the ChandrasekharSieve class with the given limit. :param n: int, the upper limit for generating prime nu...
import unittest class ChandrasekharSieveTestGeneratePrimes(unittest.TestCase): def test_generate_primes_1(self): cs = ChandrasekharSieve(20) res = cs.generate_primes() self.assertEqual(res, [2, 3, 5, 7, 11, 13, 17, 19]) def test_generate_primes_2(self): cs = ChandrasekharSieve...
class ChandrasekharSieve: def __init__(self, n): self.n = n self.primes = self.generate_primes() def generate_primes(self): if self.n < 2: return [] sieve = [True] * (self.n + 1) sieve[0] = sieve[1] = False p = 2 while p * p <= self.n: ...
[]
""" This is a class that uses the Chandrasekhar's Sieve method to find all prime numbers within the range """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.n" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def generate_primes(self):\n \"\"\"\n Generate prime numbers up to the specified limit using the Ch...
ChandrasekharSieve
[ "ChandrasekharSieveTestGeneratePrimes", "ChandrasekharSieveTestGetPrimes", "ChandrasekharSieveTest" ]
class ChandrasekharSieve: def __init__(self, n): """ Initialize the ChandrasekharSieve class with the given limit. :param n: int, the upper limit for generating prime numbers """ self.n = n self.primes = self.generate_primes()
[ "self.n", "self.primes" ]
ClassEval_19_t8
8
generate_primes
def generate_primes(self):
class ChandrasekharSieve: def __init__(self, n): self.n = n self.primes = self.generate_primes() def generate_primes(self): if self.n < 2: return [] sieve = [True] * (self.n + 1) sieve[0] = sieve[1] = False p = 2 while p * p <= self.n: ...
sieve[i] = False
p += 1 primes = [] for i in range(2, self.n + 1): if sieve[i]: primes.append(i) return primes def get_primes(self): return self.primes
ClassEval_19
class ChandrasekharSieve: """ This is a class that uses the Chandrasekhar's Sieve method to find all prime numbers within the range """ def __init__(self, n): """ Initialize the ChandrasekharSieve class with the given limit. :param n: int, the upper limit for generating prime nu...
import unittest class ChandrasekharSieveTestGeneratePrimes(unittest.TestCase): def test_generate_primes_1(self): cs = ChandrasekharSieve(20) res = cs.generate_primes() self.assertEqual(res, [2, 3, 5, 7, 11, 13, 17, 19]) def test_generate_primes_2(self): cs = ChandrasekharSieve...
class ChandrasekharSieve: def __init__(self, n): self.n = n self.primes = self.generate_primes() def generate_primes(self): if self.n < 2: return [] sieve = [True] * (self.n + 1) sieve[0] = sieve[1] = False p = 2 while p * p <= self.n: ...
[]
""" This is a class that uses the Chandrasekhar's Sieve method to find all prime numbers within the range """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.n" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def generate_primes(self):\n \"\"\"\n Generate prime numbers up to the specified limit using the Ch...
ChandrasekharSieve
[ "ChandrasekharSieveTestGeneratePrimes", "ChandrasekharSieveTestGetPrimes", "ChandrasekharSieveTest" ]
class ChandrasekharSieve: def __init__(self, n): """ Initialize the ChandrasekharSieve class with the given limit. :param n: int, the upper limit for generating prime numbers """ self.n = n self.primes = self.generate_primes()
[ "self.n", "self.primes" ]
ClassEval_19_t9
9
generate_primes
def generate_primes(self):
class ChandrasekharSieve: def __init__(self, n): self.n = n self.primes = self.generate_primes() def generate_primes(self): if self.n < 2: return [] sieve = [True] * (self.n + 1) sieve[0] = sieve[1] = False p = 2 while p * p <= self.n: ...
p += 1
primes = [] for i in range(2, self.n + 1): if sieve[i]: primes.append(i) return primes def get_primes(self): return self.primes
ClassEval_19
class ChandrasekharSieve: """ This is a class that uses the Chandrasekhar's Sieve method to find all prime numbers within the range """ def __init__(self, n): """ Initialize the ChandrasekharSieve class with the given limit. :param n: int, the upper limit for generating prime nu...
import unittest class ChandrasekharSieveTestGeneratePrimes(unittest.TestCase): def test_generate_primes_1(self): cs = ChandrasekharSieve(20) res = cs.generate_primes() self.assertEqual(res, [2, 3, 5, 7, 11, 13, 17, 19]) def test_generate_primes_2(self): cs = ChandrasekharSieve...
class ChandrasekharSieve: def __init__(self, n): self.n = n self.primes = self.generate_primes() def generate_primes(self): if self.n < 2: return [] sieve = [True] * (self.n + 1) sieve[0] = sieve[1] = False p = 2 while p * p <= self.n: ...
[]
""" This is a class that uses the Chandrasekhar's Sieve method to find all prime numbers within the range """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.n" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def generate_primes(self):\n \"\"\"\n Generate prime numbers up to the specified limit using the Ch...
ChandrasekharSieve
[ "ChandrasekharSieveTestGeneratePrimes", "ChandrasekharSieveTestGetPrimes", "ChandrasekharSieveTest" ]
class ChandrasekharSieve: def __init__(self, n): """ Initialize the ChandrasekharSieve class with the given limit. :param n: int, the upper limit for generating prime numbers """ self.n = n self.primes = self.generate_primes()
[ "self.n", "self.primes" ]
ClassEval_19_t10
10
generate_primes
def generate_primes(self):
class ChandrasekharSieve: def __init__(self, n): self.n = n self.primes = self.generate_primes() def generate_primes(self): if self.n < 2: return [] sieve = [True] * (self.n + 1) sieve[0] = sieve[1] = False p = 2 while p * p <= self.n: ...
primes = []
for i in range(2, self.n + 1): if sieve[i]: primes.append(i) return primes def get_primes(self): return self.primes
ClassEval_19
class ChandrasekharSieve: """ This is a class that uses the Chandrasekhar's Sieve method to find all prime numbers within the range """ def __init__(self, n): """ Initialize the ChandrasekharSieve class with the given limit. :param n: int, the upper limit for generating prime nu...
import unittest class ChandrasekharSieveTestGeneratePrimes(unittest.TestCase): def test_generate_primes_1(self): cs = ChandrasekharSieve(20) res = cs.generate_primes() self.assertEqual(res, [2, 3, 5, 7, 11, 13, 17, 19]) def test_generate_primes_2(self): cs = ChandrasekharSieve...
class ChandrasekharSieve: def __init__(self, n): self.n = n self.primes = self.generate_primes() def generate_primes(self): if self.n < 2: return [] sieve = [True] * (self.n + 1) sieve[0] = sieve[1] = False p = 2 while p * p <= self.n: ...
[]
""" This is a class that uses the Chandrasekhar's Sieve method to find all prime numbers within the range """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.n" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def generate_primes(self):\n \"\"\"\n Generate prime numbers up to the specified limit using the Ch...
ChandrasekharSieve
[ "ChandrasekharSieveTestGeneratePrimes", "ChandrasekharSieveTestGetPrimes", "ChandrasekharSieveTest" ]
class ChandrasekharSieve: def __init__(self, n): """ Initialize the ChandrasekharSieve class with the given limit. :param n: int, the upper limit for generating prime numbers """ self.n = n self.primes = self.generate_primes()
[ "self.n", "self.primes" ]
ClassEval_19_t11
11
generate_primes
def generate_primes(self):
class ChandrasekharSieve: def __init__(self, n): self.n = n self.primes = self.generate_primes() def generate_primes(self): if self.n < 2: return [] sieve = [True] * (self.n + 1) sieve[0] = sieve[1] = False p = 2 while p * p <= self.n: ...
for i in range(2, self.n + 1):
if sieve[i]: primes.append(i) return primes def get_primes(self): return self.primes
ClassEval_19
class ChandrasekharSieve: """ This is a class that uses the Chandrasekhar's Sieve method to find all prime numbers within the range """ def __init__(self, n): """ Initialize the ChandrasekharSieve class with the given limit. :param n: int, the upper limit for generating prime nu...
import unittest class ChandrasekharSieveTestGeneratePrimes(unittest.TestCase): def test_generate_primes_1(self): cs = ChandrasekharSieve(20) res = cs.generate_primes() self.assertEqual(res, [2, 3, 5, 7, 11, 13, 17, 19]) def test_generate_primes_2(self): cs = ChandrasekharSieve...
class ChandrasekharSieve: def __init__(self, n): self.n = n self.primes = self.generate_primes() def generate_primes(self): if self.n < 2: return [] sieve = [True] * (self.n + 1) sieve[0] = sieve[1] = False p = 2 while p * p <= self.n: ...
[]
""" This is a class that uses the Chandrasekhar's Sieve method to find all prime numbers within the range """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.n" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def generate_primes(self):\n \"\"\"\n Generate prime numbers up to the specified limit using the Ch...
ChandrasekharSieve
[ "ChandrasekharSieveTestGeneratePrimes", "ChandrasekharSieveTestGetPrimes", "ChandrasekharSieveTest" ]
class ChandrasekharSieve: def __init__(self, n): """ Initialize the ChandrasekharSieve class with the given limit. :param n: int, the upper limit for generating prime numbers """ self.n = n self.primes = self.generate_primes()
[ "self.n", "self.primes" ]
ClassEval_19_t12
12
generate_primes
def generate_primes(self):
class ChandrasekharSieve: def __init__(self, n): self.n = n self.primes = self.generate_primes() def generate_primes(self): if self.n < 2: return [] sieve = [True] * (self.n + 1) sieve[0] = sieve[1] = False p = 2 while p * p <= self.n: ...
if sieve[i]:
primes.append(i) return primes def get_primes(self): return self.primes
ClassEval_19
class ChandrasekharSieve: """ This is a class that uses the Chandrasekhar's Sieve method to find all prime numbers within the range """ def __init__(self, n): """ Initialize the ChandrasekharSieve class with the given limit. :param n: int, the upper limit for generating prime nu...
import unittest class ChandrasekharSieveTestGeneratePrimes(unittest.TestCase): def test_generate_primes_1(self): cs = ChandrasekharSieve(20) res = cs.generate_primes() self.assertEqual(res, [2, 3, 5, 7, 11, 13, 17, 19]) def test_generate_primes_2(self): cs = ChandrasekharSieve...
class ChandrasekharSieve: def __init__(self, n): self.n = n self.primes = self.generate_primes() def generate_primes(self): if self.n < 2: return [] sieve = [True] * (self.n + 1) sieve[0] = sieve[1] = False p = 2 while p * p <= self.n: ...
[]
""" This is a class that uses the Chandrasekhar's Sieve method to find all prime numbers within the range """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.n" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def generate_primes(self):\n \"\"\"\n Generate prime numbers up to the specified limit using the Ch...
ChandrasekharSieve
[ "ChandrasekharSieveTestGeneratePrimes", "ChandrasekharSieveTestGetPrimes", "ChandrasekharSieveTest" ]
class ChandrasekharSieve: def __init__(self, n): """ Initialize the ChandrasekharSieve class with the given limit. :param n: int, the upper limit for generating prime numbers """ self.n = n self.primes = self.generate_primes()
[ "self.n", "self.primes" ]
ClassEval_19_t13
13
generate_primes
def generate_primes(self):
class ChandrasekharSieve: def __init__(self, n): self.n = n self.primes = self.generate_primes() def generate_primes(self): if self.n < 2: return [] sieve = [True] * (self.n + 1) sieve[0] = sieve[1] = False p = 2 while p * p <= self.n: ...
primes.append(i)
return primes def get_primes(self): return self.primes
ClassEval_19
class ChandrasekharSieve: """ This is a class that uses the Chandrasekhar's Sieve method to find all prime numbers within the range """ def __init__(self, n): """ Initialize the ChandrasekharSieve class with the given limit. :param n: int, the upper limit for generating prime nu...
import unittest class ChandrasekharSieveTestGeneratePrimes(unittest.TestCase): def test_generate_primes_1(self): cs = ChandrasekharSieve(20) res = cs.generate_primes() self.assertEqual(res, [2, 3, 5, 7, 11, 13, 17, 19]) def test_generate_primes_2(self): cs = ChandrasekharSieve...
class ChandrasekharSieve: def __init__(self, n): self.n = n self.primes = self.generate_primes() def generate_primes(self): if self.n < 2: return [] sieve = [True] * (self.n + 1) sieve[0] = sieve[1] = False p = 2 while p * p <= self.n: ...
[]
""" This is a class that uses the Chandrasekhar's Sieve method to find all prime numbers within the range """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.n" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def generate_primes(self):\n \"\"\"\n Generate prime numbers up to the specified limit using the Ch...
ChandrasekharSieve
[ "ChandrasekharSieveTestGeneratePrimes", "ChandrasekharSieveTestGetPrimes", "ChandrasekharSieveTest" ]
class ChandrasekharSieve: def __init__(self, n): """ Initialize the ChandrasekharSieve class with the given limit. :param n: int, the upper limit for generating prime numbers """ self.n = n self.primes = self.generate_primes()
[ "self.n", "self.primes" ]
ClassEval_19_t14
14
generate_primes
def generate_primes(self):
class ChandrasekharSieve: def __init__(self, n): self.n = n self.primes = self.generate_primes() def generate_primes(self): if self.n < 2: return [] sieve = [True] * (self.n + 1) sieve[0] = sieve[1] = False p = 2 while p * p <= self.n: ...
return primes
def get_primes(self): return self.primes
ClassEval_19
class ChandrasekharSieve: """ This is a class that uses the Chandrasekhar's Sieve method to find all prime numbers within the range """ def __init__(self, n): """ Initialize the ChandrasekharSieve class with the given limit. :param n: int, the upper limit for generating prime nu...
import unittest class ChandrasekharSieveTestGeneratePrimes(unittest.TestCase): def test_generate_primes_1(self): cs = ChandrasekharSieve(20) res = cs.generate_primes() self.assertEqual(res, [2, 3, 5, 7, 11, 13, 17, 19]) def test_generate_primes_2(self): cs = ChandrasekharSieve...
class ChandrasekharSieve: def __init__(self, n): self.n = n self.primes = self.generate_primes() def generate_primes(self): if self.n < 2: return [] sieve = [True] * (self.n + 1) sieve[0] = sieve[1] = False p = 2 while p * p <= self.n: ...
[]
""" This is a class that uses the Chandrasekhar's Sieve method to find all prime numbers within the range """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.n" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def generate_primes(self):\n \"\"\"\n Generate prime numbers up to the specified limit using the Ch...
ChandrasekharSieve
[ "ChandrasekharSieveTestGeneratePrimes", "ChandrasekharSieveTestGetPrimes", "ChandrasekharSieveTest" ]
class ChandrasekharSieve: def __init__(self, n): """ Initialize the ChandrasekharSieve class with the given limit. :param n: int, the upper limit for generating prime numbers """ self.n = n self.primes = self.generate_primes()
[ "self.n", "self.primes" ]
ClassEval_19_t15
15
get_primes
def get_primes(self):
class ChandrasekharSieve: def __init__(self, n): self.n = n self.primes = self.generate_primes() def generate_primes(self): if self.n < 2: return [] sieve = [True] * (self.n + 1) sieve[0] = sieve[1] = False p = 2 while p * p <= self.n: ...
return self.primes
ClassEval_20
from datetime import datetime class Chat: """ This is a chat class with the functions of adding users, removing users, sending messages, and obtaining messages. """ def __init__(self): """ Initialize the Chat with an attribute users, which is an empty dictionary. """ se...
import unittest class ChatTestAddUser(unittest.TestCase): def test_add_user(self): chat = Chat() self.assertEqual(chat.add_user('John'), True) self.assertEqual(chat.users, {'John': []}) def test_add_user_2(self): chat = Chat() chat.users = {'John': []} self.asser...
from datetime import datetime class Chat: def __init__(self): self.users = {} def add_user(self, username): if username in self.users: return False else: self.users[username] = [] return True def remove_user(self, username): if username ...
[ "from datetime import datetime" ]
""" This is a chat class with the functions of adding users, removing users, sending messages, and obtaining messages. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.users" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_user(self, username):\n \"\"\"\n Add a new user to the Chat.\n :param username: ...
Chat
[ "ChatTestAddUser", "ChatTestRemoveUser", "ChatTestSendMessage", "ChatTestGetMessages", "ChatTestMain" ]
class Chat: def __init__(self): """ Initialize the Chat with an attribute users, which is an empty dictionary. """ self.users = {}
[ "self.users" ]
ClassEval_20_t0
0
add_user
def add_user(self, username):
from datetime import datetime class Chat: def __init__(self): self.users = {} def add_user(self, username):
if username in self.users:
return False else: self.users[username] = [] return True def remove_user(self, username): if username in self.users: del self.users[username] return True else: return False def send_message(self, sender, receiver, ...
ClassEval_20
from datetime import datetime class Chat: """ This is a chat class with the functions of adding users, removing users, sending messages, and obtaining messages. """ def __init__(self): """ Initialize the Chat with an attribute users, which is an empty dictionary. """ se...
import unittest class ChatTestAddUser(unittest.TestCase): def test_add_user(self): chat = Chat() self.assertEqual(chat.add_user('John'), True) self.assertEqual(chat.users, {'John': []}) def test_add_user_2(self): chat = Chat() chat.users = {'John': []} self.asser...
from datetime import datetime class Chat: def __init__(self): self.users = {} def add_user(self, username): if username in self.users: return False else: self.users[username] = [] return True def remove_user(self, username): if username ...
[ "from datetime import datetime" ]
""" This is a chat class with the functions of adding users, removing users, sending messages, and obtaining messages. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.users" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_user(self, username):\n \"\"\"\n Add a new user to the Chat.\n :param username: ...
Chat
[ "ChatTestAddUser", "ChatTestRemoveUser", "ChatTestSendMessage", "ChatTestGetMessages", "ChatTestMain" ]
class Chat: def __init__(self): """ Initialize the Chat with an attribute users, which is an empty dictionary. """ self.users = {}
[ "self.users" ]
ClassEval_20_t1
1
add_user
def add_user(self, username):
from datetime import datetime class Chat: def __init__(self): self.users = {} def add_user(self, username): if username in self.users:
return False
else: self.users[username] = [] return True def remove_user(self, username): if username in self.users: del self.users[username] return True else: return False def send_message(self, sender, receiver, message): if send...
ClassEval_20
from datetime import datetime class Chat: """ This is a chat class with the functions of adding users, removing users, sending messages, and obtaining messages. """ def __init__(self): """ Initialize the Chat with an attribute users, which is an empty dictionary. """ se...
import unittest class ChatTestAddUser(unittest.TestCase): def test_add_user(self): chat = Chat() self.assertEqual(chat.add_user('John'), True) self.assertEqual(chat.users, {'John': []}) def test_add_user_2(self): chat = Chat() chat.users = {'John': []} self.asser...
from datetime import datetime class Chat: def __init__(self): self.users = {} def add_user(self, username): if username in self.users: return False else: self.users[username] = [] return True def remove_user(self, username): if username ...
[ "from datetime import datetime" ]
""" This is a chat class with the functions of adding users, removing users, sending messages, and obtaining messages. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.users" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_user(self, username):\n \"\"\"\n Add a new user to the Chat.\n :param username: ...
Chat
[ "ChatTestAddUser", "ChatTestRemoveUser", "ChatTestSendMessage", "ChatTestGetMessages", "ChatTestMain" ]
class Chat: def __init__(self): """ Initialize the Chat with an attribute users, which is an empty dictionary. """ self.users = {}
[ "self.users" ]
ClassEval_20_t2
2
add_user
def add_user(self, username):
from datetime import datetime class Chat: def __init__(self): self.users = {} def add_user(self, username): if username in self.users: return False
else:
self.users[username] = [] return True def remove_user(self, username): if username in self.users: del self.users[username] return True else: return False def send_message(self, sender, receiver, message): if sender not in self...
ClassEval_20
from datetime import datetime class Chat: """ This is a chat class with the functions of adding users, removing users, sending messages, and obtaining messages. """ def __init__(self): """ Initialize the Chat with an attribute users, which is an empty dictionary. """ se...
import unittest class ChatTestAddUser(unittest.TestCase): def test_add_user(self): chat = Chat() self.assertEqual(chat.add_user('John'), True) self.assertEqual(chat.users, {'John': []}) def test_add_user_2(self): chat = Chat() chat.users = {'John': []} self.asser...
from datetime import datetime class Chat: def __init__(self): self.users = {} def add_user(self, username): if username in self.users: return False else: self.users[username] = [] return True def remove_user(self, username): if username ...
[ "from datetime import datetime" ]
""" This is a chat class with the functions of adding users, removing users, sending messages, and obtaining messages. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.users" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_user(self, username):\n \"\"\"\n Add a new user to the Chat.\n :param username: ...
Chat
[ "ChatTestAddUser", "ChatTestRemoveUser", "ChatTestSendMessage", "ChatTestGetMessages", "ChatTestMain" ]
class Chat: def __init__(self): """ Initialize the Chat with an attribute users, which is an empty dictionary. """ self.users = {}
[ "self.users" ]
ClassEval_20_t3
3
add_user
def add_user(self, username):
from datetime import datetime class Chat: def __init__(self): self.users = {} def add_user(self, username): if username in self.users: return False else:
self.users[username] = []
return True def remove_user(self, username): if username in self.users: del self.users[username] return True else: return False def send_message(self, sender, receiver, message): if sender not in self.users or receiver not in self.users: ...
ClassEval_20
from datetime import datetime class Chat: """ This is a chat class with the functions of adding users, removing users, sending messages, and obtaining messages. """ def __init__(self): """ Initialize the Chat with an attribute users, which is an empty dictionary. """ se...
import unittest class ChatTestAddUser(unittest.TestCase): def test_add_user(self): chat = Chat() self.assertEqual(chat.add_user('John'), True) self.assertEqual(chat.users, {'John': []}) def test_add_user_2(self): chat = Chat() chat.users = {'John': []} self.asser...
from datetime import datetime class Chat: def __init__(self): self.users = {} def add_user(self, username): if username in self.users: return False else: self.users[username] = [] return True def remove_user(self, username): if username ...
[ "from datetime import datetime" ]
""" This is a chat class with the functions of adding users, removing users, sending messages, and obtaining messages. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.users" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_user(self, username):\n \"\"\"\n Add a new user to the Chat.\n :param username: ...
Chat
[ "ChatTestAddUser", "ChatTestRemoveUser", "ChatTestSendMessage", "ChatTestGetMessages", "ChatTestMain" ]
class Chat: def __init__(self): """ Initialize the Chat with an attribute users, which is an empty dictionary. """ self.users = {}
[ "self.users" ]
ClassEval_20_t4
4
add_user
def add_user(self, username):
from datetime import datetime class Chat: def __init__(self): self.users = {} def add_user(self, username): if username in self.users: return False else: self.users[username] = []
return True
def remove_user(self, username): if username in self.users: del self.users[username] return True else: return False def send_message(self, sender, receiver, message): if sender not in self.users or receiver not in self.users: return False...
ClassEval_20
from datetime import datetime class Chat: """ This is a chat class with the functions of adding users, removing users, sending messages, and obtaining messages. """ def __init__(self): """ Initialize the Chat with an attribute users, which is an empty dictionary. """ se...
import unittest class ChatTestAddUser(unittest.TestCase): def test_add_user(self): chat = Chat() self.assertEqual(chat.add_user('John'), True) self.assertEqual(chat.users, {'John': []}) def test_add_user_2(self): chat = Chat() chat.users = {'John': []} self.asser...
from datetime import datetime class Chat: def __init__(self): self.users = {} def add_user(self, username): if username in self.users: return False else: self.users[username] = [] return True def remove_user(self, username): if username ...
[ "from datetime import datetime" ]
""" This is a chat class with the functions of adding users, removing users, sending messages, and obtaining messages. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.users" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_user(self, username):\n \"\"\"\n Add a new user to the Chat.\n :param username: ...
Chat
[ "ChatTestAddUser", "ChatTestRemoveUser", "ChatTestSendMessage", "ChatTestGetMessages", "ChatTestMain" ]
class Chat: def __init__(self): """ Initialize the Chat with an attribute users, which is an empty dictionary. """ self.users = {}
[ "self.users" ]
ClassEval_20_t5
5
remove_user
def remove_user(self, username):
from datetime import datetime class Chat: def __init__(self): self.users = {} def add_user(self, username): if username in self.users: return False else: self.users[username] = [] return True def remove_user(self, username):
if username in self.users:
del self.users[username] return True else: return False def send_message(self, sender, receiver, message): if sender not in self.users or receiver not in self.users: return False timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S") ...
ClassEval_20
from datetime import datetime class Chat: """ This is a chat class with the functions of adding users, removing users, sending messages, and obtaining messages. """ def __init__(self): """ Initialize the Chat with an attribute users, which is an empty dictionary. """ se...
import unittest class ChatTestAddUser(unittest.TestCase): def test_add_user(self): chat = Chat() self.assertEqual(chat.add_user('John'), True) self.assertEqual(chat.users, {'John': []}) def test_add_user_2(self): chat = Chat() chat.users = {'John': []} self.asser...
from datetime import datetime class Chat: def __init__(self): self.users = {} def add_user(self, username): if username in self.users: return False else: self.users[username] = [] return True def remove_user(self, username): if username ...
[ "from datetime import datetime" ]
""" This is a chat class with the functions of adding users, removing users, sending messages, and obtaining messages. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.users" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_user(self, username):\n \"\"\"\n Add a new user to the Chat.\n :param username: ...
Chat
[ "ChatTestAddUser", "ChatTestRemoveUser", "ChatTestSendMessage", "ChatTestGetMessages", "ChatTestMain" ]
class Chat: def __init__(self): """ Initialize the Chat with an attribute users, which is an empty dictionary. """ self.users = {}
[ "self.users" ]
ClassEval_20_t6
6
remove_user
def remove_user(self, username):
from datetime import datetime class Chat: def __init__(self): self.users = {} def add_user(self, username): if username in self.users: return False else: self.users[username] = [] return True def remove_user(self, username): if username ...
del self.users[username]
return True else: return False def send_message(self, sender, receiver, message): if sender not in self.users or receiver not in self.users: return False timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S") message_info = { 'sende...
ClassEval_20
from datetime import datetime class Chat: """ This is a chat class with the functions of adding users, removing users, sending messages, and obtaining messages. """ def __init__(self): """ Initialize the Chat with an attribute users, which is an empty dictionary. """ se...
import unittest class ChatTestAddUser(unittest.TestCase): def test_add_user(self): chat = Chat() self.assertEqual(chat.add_user('John'), True) self.assertEqual(chat.users, {'John': []}) def test_add_user_2(self): chat = Chat() chat.users = {'John': []} self.asser...
from datetime import datetime class Chat: def __init__(self): self.users = {} def add_user(self, username): if username in self.users: return False else: self.users[username] = [] return True def remove_user(self, username): if username ...
[ "from datetime import datetime" ]
""" This is a chat class with the functions of adding users, removing users, sending messages, and obtaining messages. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.users" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_user(self, username):\n \"\"\"\n Add a new user to the Chat.\n :param username: ...
Chat
[ "ChatTestAddUser", "ChatTestRemoveUser", "ChatTestSendMessage", "ChatTestGetMessages", "ChatTestMain" ]
class Chat: def __init__(self): """ Initialize the Chat with an attribute users, which is an empty dictionary. """ self.users = {}
[ "self.users" ]
ClassEval_20_t7
7
remove_user
def remove_user(self, username):
from datetime import datetime class Chat: def __init__(self): self.users = {} def add_user(self, username): if username in self.users: return False else: self.users[username] = [] return True def remove_user(self, username): if username ...
return True
else: return False def send_message(self, sender, receiver, message): if sender not in self.users or receiver not in self.users: return False timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S") message_info = { 'sender': sender, ...
ClassEval_20
from datetime import datetime class Chat: """ This is a chat class with the functions of adding users, removing users, sending messages, and obtaining messages. """ def __init__(self): """ Initialize the Chat with an attribute users, which is an empty dictionary. """ se...
import unittest class ChatTestAddUser(unittest.TestCase): def test_add_user(self): chat = Chat() self.assertEqual(chat.add_user('John'), True) self.assertEqual(chat.users, {'John': []}) def test_add_user_2(self): chat = Chat() chat.users = {'John': []} self.asser...
from datetime import datetime class Chat: def __init__(self): self.users = {} def add_user(self, username): if username in self.users: return False else: self.users[username] = [] return True def remove_user(self, username): if username ...
[ "from datetime import datetime" ]
""" This is a chat class with the functions of adding users, removing users, sending messages, and obtaining messages. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.users" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_user(self, username):\n \"\"\"\n Add a new user to the Chat.\n :param username: ...
Chat
[ "ChatTestAddUser", "ChatTestRemoveUser", "ChatTestSendMessage", "ChatTestGetMessages", "ChatTestMain" ]
class Chat: def __init__(self): """ Initialize the Chat with an attribute users, which is an empty dictionary. """ self.users = {}
[ "self.users" ]
ClassEval_20_t8
8
remove_user
def remove_user(self, username):
from datetime import datetime class Chat: def __init__(self): self.users = {} def add_user(self, username): if username in self.users: return False else: self.users[username] = [] return True def remove_user(self, username): if username ...
else:
return False def send_message(self, sender, receiver, message): if sender not in self.users or receiver not in self.users: return False timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S") message_info = { 'sender': sender, 'receiver': re...
ClassEval_20
from datetime import datetime class Chat: """ This is a chat class with the functions of adding users, removing users, sending messages, and obtaining messages. """ def __init__(self): """ Initialize the Chat with an attribute users, which is an empty dictionary. """ se...
import unittest class ChatTestAddUser(unittest.TestCase): def test_add_user(self): chat = Chat() self.assertEqual(chat.add_user('John'), True) self.assertEqual(chat.users, {'John': []}) def test_add_user_2(self): chat = Chat() chat.users = {'John': []} self.asser...
from datetime import datetime class Chat: def __init__(self): self.users = {} def add_user(self, username): if username in self.users: return False else: self.users[username] = [] return True def remove_user(self, username): if username ...
[ "from datetime import datetime" ]
""" This is a chat class with the functions of adding users, removing users, sending messages, and obtaining messages. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.users" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_user(self, username):\n \"\"\"\n Add a new user to the Chat.\n :param username: ...
Chat
[ "ChatTestAddUser", "ChatTestRemoveUser", "ChatTestSendMessage", "ChatTestGetMessages", "ChatTestMain" ]
class Chat: def __init__(self): """ Initialize the Chat with an attribute users, which is an empty dictionary. """ self.users = {}
[ "self.users" ]
ClassEval_20_t9
9
remove_user
def remove_user(self, username):
from datetime import datetime class Chat: def __init__(self): self.users = {} def add_user(self, username): if username in self.users: return False else: self.users[username] = [] return True def remove_user(self, username): if username ...
return False
def send_message(self, sender, receiver, message): if sender not in self.users or receiver not in self.users: return False timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S") message_info = { 'sender': sender, 'receiver': receiver, 'mess...
ClassEval_20
from datetime import datetime class Chat: """ This is a chat class with the functions of adding users, removing users, sending messages, and obtaining messages. """ def __init__(self): """ Initialize the Chat with an attribute users, which is an empty dictionary. """ se...
import unittest class ChatTestAddUser(unittest.TestCase): def test_add_user(self): chat = Chat() self.assertEqual(chat.add_user('John'), True) self.assertEqual(chat.users, {'John': []}) def test_add_user_2(self): chat = Chat() chat.users = {'John': []} self.asser...
from datetime import datetime class Chat: def __init__(self): self.users = {} def add_user(self, username): if username in self.users: return False else: self.users[username] = [] return True def remove_user(self, username): if username ...
[ "from datetime import datetime" ]
""" This is a chat class with the functions of adding users, removing users, sending messages, and obtaining messages. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.users" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_user(self, username):\n \"\"\"\n Add a new user to the Chat.\n :param username: ...
Chat
[ "ChatTestAddUser", "ChatTestRemoveUser", "ChatTestSendMessage", "ChatTestGetMessages", "ChatTestMain" ]
class Chat: def __init__(self): """ Initialize the Chat with an attribute users, which is an empty dictionary. """ self.users = {}
[ "self.users" ]
ClassEval_20_t10
10
send_message
def send_message(self, sender, receiver, message):
from datetime import datetime class Chat: def __init__(self): self.users = {} def add_user(self, username): if username in self.users: return False else: self.users[username] = [] return True def remove_user(self, username): if username ...
if sender not in self.users or receiver not in self.users:
return False timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S") message_info = { 'sender': sender, 'receiver': receiver, 'message': message, 'timestamp': timestamp } self.users[sender].append(message_info) self.us...
ClassEval_20
from datetime import datetime class Chat: """ This is a chat class with the functions of adding users, removing users, sending messages, and obtaining messages. """ def __init__(self): """ Initialize the Chat with an attribute users, which is an empty dictionary. """ se...
import unittest class ChatTestAddUser(unittest.TestCase): def test_add_user(self): chat = Chat() self.assertEqual(chat.add_user('John'), True) self.assertEqual(chat.users, {'John': []}) def test_add_user_2(self): chat = Chat() chat.users = {'John': []} self.asser...
from datetime import datetime class Chat: def __init__(self): self.users = {} def add_user(self, username): if username in self.users: return False else: self.users[username] = [] return True def remove_user(self, username): if username ...
[ "from datetime import datetime" ]
""" This is a chat class with the functions of adding users, removing users, sending messages, and obtaining messages. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.users" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_user(self, username):\n \"\"\"\n Add a new user to the Chat.\n :param username: ...
Chat
[ "ChatTestAddUser", "ChatTestRemoveUser", "ChatTestSendMessage", "ChatTestGetMessages", "ChatTestMain" ]
class Chat: def __init__(self): """ Initialize the Chat with an attribute users, which is an empty dictionary. """ self.users = {}
[ "self.users" ]
ClassEval_20_t11
11
send_message
def send_message(self, sender, receiver, message):
from datetime import datetime class Chat: def __init__(self): self.users = {} def add_user(self, username): if username in self.users: return False else: self.users[username] = [] return True def remove_user(self, username): if username ...
return False
timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S") message_info = { 'sender': sender, 'receiver': receiver, 'message': message, 'timestamp': timestamp } self.users[sender].append(message_info) self.users[receiver].append(mess...
ClassEval_20
from datetime import datetime class Chat: """ This is a chat class with the functions of adding users, removing users, sending messages, and obtaining messages. """ def __init__(self): """ Initialize the Chat with an attribute users, which is an empty dictionary. """ se...
import unittest class ChatTestAddUser(unittest.TestCase): def test_add_user(self): chat = Chat() self.assertEqual(chat.add_user('John'), True) self.assertEqual(chat.users, {'John': []}) def test_add_user_2(self): chat = Chat() chat.users = {'John': []} self.asser...
from datetime import datetime class Chat: def __init__(self): self.users = {} def add_user(self, username): if username in self.users: return False else: self.users[username] = [] return True def remove_user(self, username): if username ...
[ "from datetime import datetime" ]
""" This is a chat class with the functions of adding users, removing users, sending messages, and obtaining messages. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.users" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_user(self, username):\n \"\"\"\n Add a new user to the Chat.\n :param username: ...
Chat
[ "ChatTestAddUser", "ChatTestRemoveUser", "ChatTestSendMessage", "ChatTestGetMessages", "ChatTestMain" ]
class Chat: def __init__(self): """ Initialize the Chat with an attribute users, which is an empty dictionary. """ self.users = {}
[ "self.users" ]
ClassEval_20_t12
12
send_message
def send_message(self, sender, receiver, message):
from datetime import datetime class Chat: def __init__(self): self.users = {} def add_user(self, username): if username in self.users: return False else: self.users[username] = [] return True def remove_user(self, username): if username ...
timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
message_info = { 'sender': sender, 'receiver': receiver, 'message': message, 'timestamp': timestamp } self.users[sender].append(message_info) self.users[receiver].append(message_info) return True def get_messages(self, username...
ClassEval_20
from datetime import datetime class Chat: """ This is a chat class with the functions of adding users, removing users, sending messages, and obtaining messages. """ def __init__(self): """ Initialize the Chat with an attribute users, which is an empty dictionary. """ se...
import unittest class ChatTestAddUser(unittest.TestCase): def test_add_user(self): chat = Chat() self.assertEqual(chat.add_user('John'), True) self.assertEqual(chat.users, {'John': []}) def test_add_user_2(self): chat = Chat() chat.users = {'John': []} self.asser...
from datetime import datetime class Chat: def __init__(self): self.users = {} def add_user(self, username): if username in self.users: return False else: self.users[username] = [] return True def remove_user(self, username): if username ...
[ "from datetime import datetime" ]
""" This is a chat class with the functions of adding users, removing users, sending messages, and obtaining messages. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.users" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_user(self, username):\n \"\"\"\n Add a new user to the Chat.\n :param username: ...
Chat
[ "ChatTestAddUser", "ChatTestRemoveUser", "ChatTestSendMessage", "ChatTestGetMessages", "ChatTestMain" ]
class Chat: def __init__(self): """ Initialize the Chat with an attribute users, which is an empty dictionary. """ self.users = {}
[ "self.users" ]
ClassEval_20_t13
13
send_message
def send_message(self, sender, receiver, message):
from datetime import datetime class Chat: def __init__(self): self.users = {} def add_user(self, username): if username in self.users: return False else: self.users[username] = [] return True def remove_user(self, username): if username ...
message_info = {
'sender': sender, 'receiver': receiver, 'message': message, 'timestamp': timestamp } self.users[sender].append(message_info) self.users[receiver].append(message_info) return True def get_messages(self, username): if username no...
ClassEval_20
from datetime import datetime class Chat: """ This is a chat class with the functions of adding users, removing users, sending messages, and obtaining messages. """ def __init__(self): """ Initialize the Chat with an attribute users, which is an empty dictionary. """ se...
import unittest class ChatTestAddUser(unittest.TestCase): def test_add_user(self): chat = Chat() self.assertEqual(chat.add_user('John'), True) self.assertEqual(chat.users, {'John': []}) def test_add_user_2(self): chat = Chat() chat.users = {'John': []} self.asser...
from datetime import datetime class Chat: def __init__(self): self.users = {} def add_user(self, username): if username in self.users: return False else: self.users[username] = [] return True def remove_user(self, username): if username ...
[ "from datetime import datetime" ]
""" This is a chat class with the functions of adding users, removing users, sending messages, and obtaining messages. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.users" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_user(self, username):\n \"\"\"\n Add a new user to the Chat.\n :param username: ...
Chat
[ "ChatTestAddUser", "ChatTestRemoveUser", "ChatTestSendMessage", "ChatTestGetMessages", "ChatTestMain" ]
class Chat: def __init__(self): """ Initialize the Chat with an attribute users, which is an empty dictionary. """ self.users = {}
[ "self.users" ]
ClassEval_20_t14
14
send_message
def send_message(self, sender, receiver, message):
from datetime import datetime class Chat: def __init__(self): self.users = {} def add_user(self, username): if username in self.users: return False else: self.users[username] = [] return True def remove_user(self, username): if username ...
'sender': sender,
'receiver': receiver, 'message': message, 'timestamp': timestamp } self.users[sender].append(message_info) self.users[receiver].append(message_info) return True def get_messages(self, username): if username not in self.users: r...
ClassEval_20
from datetime import datetime class Chat: """ This is a chat class with the functions of adding users, removing users, sending messages, and obtaining messages. """ def __init__(self): """ Initialize the Chat with an attribute users, which is an empty dictionary. """ se...
import unittest class ChatTestAddUser(unittest.TestCase): def test_add_user(self): chat = Chat() self.assertEqual(chat.add_user('John'), True) self.assertEqual(chat.users, {'John': []}) def test_add_user_2(self): chat = Chat() chat.users = {'John': []} self.asser...
from datetime import datetime class Chat: def __init__(self): self.users = {} def add_user(self, username): if username in self.users: return False else: self.users[username] = [] return True def remove_user(self, username): if username ...
[ "from datetime import datetime" ]
""" This is a chat class with the functions of adding users, removing users, sending messages, and obtaining messages. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.users" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_user(self, username):\n \"\"\"\n Add a new user to the Chat.\n :param username: ...
Chat
[ "ChatTestAddUser", "ChatTestRemoveUser", "ChatTestSendMessage", "ChatTestGetMessages", "ChatTestMain" ]
class Chat: def __init__(self): """ Initialize the Chat with an attribute users, which is an empty dictionary. """ self.users = {}
[ "self.users" ]
ClassEval_20_t15
15
send_message
def send_message(self, sender, receiver, message):
from datetime import datetime class Chat: def __init__(self): self.users = {} def add_user(self, username): if username in self.users: return False else: self.users[username] = [] return True def remove_user(self, username): if username ...
'receiver': receiver,
'message': message, 'timestamp': timestamp } self.users[sender].append(message_info) self.users[receiver].append(message_info) return True def get_messages(self, username): if username not in self.users: return [] return self.users...
ClassEval_20
from datetime import datetime class Chat: """ This is a chat class with the functions of adding users, removing users, sending messages, and obtaining messages. """ def __init__(self): """ Initialize the Chat with an attribute users, which is an empty dictionary. """ se...
import unittest class ChatTestAddUser(unittest.TestCase): def test_add_user(self): chat = Chat() self.assertEqual(chat.add_user('John'), True) self.assertEqual(chat.users, {'John': []}) def test_add_user_2(self): chat = Chat() chat.users = {'John': []} self.asser...
from datetime import datetime class Chat: def __init__(self): self.users = {} def add_user(self, username): if username in self.users: return False else: self.users[username] = [] return True def remove_user(self, username): if username ...
[ "from datetime import datetime" ]
""" This is a chat class with the functions of adding users, removing users, sending messages, and obtaining messages. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.users" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_user(self, username):\n \"\"\"\n Add a new user to the Chat.\n :param username: ...
Chat
[ "ChatTestAddUser", "ChatTestRemoveUser", "ChatTestSendMessage", "ChatTestGetMessages", "ChatTestMain" ]
class Chat: def __init__(self): """ Initialize the Chat with an attribute users, which is an empty dictionary. """ self.users = {}
[ "self.users" ]
ClassEval_20_t16
16
send_message
def send_message(self, sender, receiver, message):
from datetime import datetime class Chat: def __init__(self): self.users = {} def add_user(self, username): if username in self.users: return False else: self.users[username] = [] return True def remove_user(self, username): if username ...
'message': message,
'timestamp': timestamp } self.users[sender].append(message_info) self.users[receiver].append(message_info) return True def get_messages(self, username): if username not in self.users: return [] return self.users[username]
ClassEval_20
from datetime import datetime class Chat: """ This is a chat class with the functions of adding users, removing users, sending messages, and obtaining messages. """ def __init__(self): """ Initialize the Chat with an attribute users, which is an empty dictionary. """ se...
import unittest class ChatTestAddUser(unittest.TestCase): def test_add_user(self): chat = Chat() self.assertEqual(chat.add_user('John'), True) self.assertEqual(chat.users, {'John': []}) def test_add_user_2(self): chat = Chat() chat.users = {'John': []} self.asser...
from datetime import datetime class Chat: def __init__(self): self.users = {} def add_user(self, username): if username in self.users: return False else: self.users[username] = [] return True def remove_user(self, username): if username ...
[ "from datetime import datetime" ]
""" This is a chat class with the functions of adding users, removing users, sending messages, and obtaining messages. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.users" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_user(self, username):\n \"\"\"\n Add a new user to the Chat.\n :param username: ...
Chat
[ "ChatTestAddUser", "ChatTestRemoveUser", "ChatTestSendMessage", "ChatTestGetMessages", "ChatTestMain" ]
class Chat: def __init__(self): """ Initialize the Chat with an attribute users, which is an empty dictionary. """ self.users = {}
[ "self.users" ]
ClassEval_20_t17
17
send_message
def send_message(self, sender, receiver, message):
from datetime import datetime class Chat: def __init__(self): self.users = {} def add_user(self, username): if username in self.users: return False else: self.users[username] = [] return True def remove_user(self, username): if username ...
'timestamp': timestamp
} self.users[sender].append(message_info) self.users[receiver].append(message_info) return True def get_messages(self, username): if username not in self.users: return [] return self.users[username]
ClassEval_20
from datetime import datetime class Chat: """ This is a chat class with the functions of adding users, removing users, sending messages, and obtaining messages. """ def __init__(self): """ Initialize the Chat with an attribute users, which is an empty dictionary. """ se...
import unittest class ChatTestAddUser(unittest.TestCase): def test_add_user(self): chat = Chat() self.assertEqual(chat.add_user('John'), True) self.assertEqual(chat.users, {'John': []}) def test_add_user_2(self): chat = Chat() chat.users = {'John': []} self.asser...
from datetime import datetime class Chat: def __init__(self): self.users = {} def add_user(self, username): if username in self.users: return False else: self.users[username] = [] return True def remove_user(self, username): if username ...
[ "from datetime import datetime" ]
""" This is a chat class with the functions of adding users, removing users, sending messages, and obtaining messages. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.users" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_user(self, username):\n \"\"\"\n Add a new user to the Chat.\n :param username: ...
Chat
[ "ChatTestAddUser", "ChatTestRemoveUser", "ChatTestSendMessage", "ChatTestGetMessages", "ChatTestMain" ]
class Chat: def __init__(self): """ Initialize the Chat with an attribute users, which is an empty dictionary. """ self.users = {}
[ "self.users" ]
ClassEval_20_t18
18
send_message
def send_message(self, sender, receiver, message):
from datetime import datetime class Chat: def __init__(self): self.users = {} def add_user(self, username): if username in self.users: return False else: self.users[username] = [] return True def remove_user(self, username): if username ...
}
self.users[sender].append(message_info) self.users[receiver].append(message_info) return True def get_messages(self, username): if username not in self.users: return [] return self.users[username]
ClassEval_20
from datetime import datetime class Chat: """ This is a chat class with the functions of adding users, removing users, sending messages, and obtaining messages. """ def __init__(self): """ Initialize the Chat with an attribute users, which is an empty dictionary. """ se...
import unittest class ChatTestAddUser(unittest.TestCase): def test_add_user(self): chat = Chat() self.assertEqual(chat.add_user('John'), True) self.assertEqual(chat.users, {'John': []}) def test_add_user_2(self): chat = Chat() chat.users = {'John': []} self.asser...
from datetime import datetime class Chat: def __init__(self): self.users = {} def add_user(self, username): if username in self.users: return False else: self.users[username] = [] return True def remove_user(self, username): if username ...
[ "from datetime import datetime" ]
""" This is a chat class with the functions of adding users, removing users, sending messages, and obtaining messages. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.users" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_user(self, username):\n \"\"\"\n Add a new user to the Chat.\n :param username: ...
Chat
[ "ChatTestAddUser", "ChatTestRemoveUser", "ChatTestSendMessage", "ChatTestGetMessages", "ChatTestMain" ]
class Chat: def __init__(self): """ Initialize the Chat with an attribute users, which is an empty dictionary. """ self.users = {}
[ "self.users" ]
ClassEval_20_t19
19
send_message
def send_message(self, sender, receiver, message):
from datetime import datetime class Chat: def __init__(self): self.users = {} def add_user(self, username): if username in self.users: return False else: self.users[username] = [] return True def remove_user(self, username): if username ...
self.users[sender].append(message_info)
self.users[receiver].append(message_info) return True def get_messages(self, username): if username not in self.users: return [] return self.users[username]
ClassEval_20
from datetime import datetime class Chat: """ This is a chat class with the functions of adding users, removing users, sending messages, and obtaining messages. """ def __init__(self): """ Initialize the Chat with an attribute users, which is an empty dictionary. """ se...
import unittest class ChatTestAddUser(unittest.TestCase): def test_add_user(self): chat = Chat() self.assertEqual(chat.add_user('John'), True) self.assertEqual(chat.users, {'John': []}) def test_add_user_2(self): chat = Chat() chat.users = {'John': []} self.asser...
from datetime import datetime class Chat: def __init__(self): self.users = {} def add_user(self, username): if username in self.users: return False else: self.users[username] = [] return True def remove_user(self, username): if username ...
[ "from datetime import datetime" ]
""" This is a chat class with the functions of adding users, removing users, sending messages, and obtaining messages. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.users" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_user(self, username):\n \"\"\"\n Add a new user to the Chat.\n :param username: ...
Chat
[ "ChatTestAddUser", "ChatTestRemoveUser", "ChatTestSendMessage", "ChatTestGetMessages", "ChatTestMain" ]
class Chat: def __init__(self): """ Initialize the Chat with an attribute users, which is an empty dictionary. """ self.users = {}
[ "self.users" ]
ClassEval_20_t20
20
send_message
def send_message(self, sender, receiver, message):
from datetime import datetime class Chat: def __init__(self): self.users = {} def add_user(self, username): if username in self.users: return False else: self.users[username] = [] return True def remove_user(self, username): if username ...
self.users[receiver].append(message_info)
return True def get_messages(self, username): if username not in self.users: return [] return self.users[username]
ClassEval_20
from datetime import datetime class Chat: """ This is a chat class with the functions of adding users, removing users, sending messages, and obtaining messages. """ def __init__(self): """ Initialize the Chat with an attribute users, which is an empty dictionary. """ se...
import unittest class ChatTestAddUser(unittest.TestCase): def test_add_user(self): chat = Chat() self.assertEqual(chat.add_user('John'), True) self.assertEqual(chat.users, {'John': []}) def test_add_user_2(self): chat = Chat() chat.users = {'John': []} self.asser...
from datetime import datetime class Chat: def __init__(self): self.users = {} def add_user(self, username): if username in self.users: return False else: self.users[username] = [] return True def remove_user(self, username): if username ...
[ "from datetime import datetime" ]
""" This is a chat class with the functions of adding users, removing users, sending messages, and obtaining messages. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.users" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_user(self, username):\n \"\"\"\n Add a new user to the Chat.\n :param username: ...
Chat
[ "ChatTestAddUser", "ChatTestRemoveUser", "ChatTestSendMessage", "ChatTestGetMessages", "ChatTestMain" ]
class Chat: def __init__(self): """ Initialize the Chat with an attribute users, which is an empty dictionary. """ self.users = {}
[ "self.users" ]
ClassEval_20_t21
21
send_message
def send_message(self, sender, receiver, message):
from datetime import datetime class Chat: def __init__(self): self.users = {} def add_user(self, username): if username in self.users: return False else: self.users[username] = [] return True def remove_user(self, username): if username ...
return True
def get_messages(self, username): if username not in self.users: return [] return self.users[username]
ClassEval_20
from datetime import datetime class Chat: """ This is a chat class with the functions of adding users, removing users, sending messages, and obtaining messages. """ def __init__(self): """ Initialize the Chat with an attribute users, which is an empty dictionary. """ se...
import unittest class ChatTestAddUser(unittest.TestCase): def test_add_user(self): chat = Chat() self.assertEqual(chat.add_user('John'), True) self.assertEqual(chat.users, {'John': []}) def test_add_user_2(self): chat = Chat() chat.users = {'John': []} self.asser...
from datetime import datetime class Chat: def __init__(self): self.users = {} def add_user(self, username): if username in self.users: return False else: self.users[username] = [] return True def remove_user(self, username): if username ...
[ "from datetime import datetime" ]
""" This is a chat class with the functions of adding users, removing users, sending messages, and obtaining messages. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.users" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_user(self, username):\n \"\"\"\n Add a new user to the Chat.\n :param username: ...
Chat
[ "ChatTestAddUser", "ChatTestRemoveUser", "ChatTestSendMessage", "ChatTestGetMessages", "ChatTestMain" ]
class Chat: def __init__(self): """ Initialize the Chat with an attribute users, which is an empty dictionary. """ self.users = {}
[ "self.users" ]
ClassEval_20_t22
22
get_messages
def get_messages(self, username):
from datetime import datetime class Chat: def __init__(self): self.users = {} def add_user(self, username): if username in self.users: return False else: self.users[username] = [] return True def remove_user(self, username): if username ...
if username not in self.users:
return [] return self.users[username]
ClassEval_20
from datetime import datetime class Chat: """ This is a chat class with the functions of adding users, removing users, sending messages, and obtaining messages. """ def __init__(self): """ Initialize the Chat with an attribute users, which is an empty dictionary. """ se...
import unittest class ChatTestAddUser(unittest.TestCase): def test_add_user(self): chat = Chat() self.assertEqual(chat.add_user('John'), True) self.assertEqual(chat.users, {'John': []}) def test_add_user_2(self): chat = Chat() chat.users = {'John': []} self.asser...
from datetime import datetime class Chat: def __init__(self): self.users = {} def add_user(self, username): if username in self.users: return False else: self.users[username] = [] return True def remove_user(self, username): if username ...
[ "from datetime import datetime" ]
""" This is a chat class with the functions of adding users, removing users, sending messages, and obtaining messages. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.users" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_user(self, username):\n \"\"\"\n Add a new user to the Chat.\n :param username: ...
Chat
[ "ChatTestAddUser", "ChatTestRemoveUser", "ChatTestSendMessage", "ChatTestGetMessages", "ChatTestMain" ]
class Chat: def __init__(self): """ Initialize the Chat with an attribute users, which is an empty dictionary. """ self.users = {}
[ "self.users" ]
ClassEval_20_t23
23
get_messages
def get_messages(self, username):
from datetime import datetime class Chat: def __init__(self): self.users = {} def add_user(self, username): if username in self.users: return False else: self.users[username] = [] return True def remove_user(self, username): if username ...
return []
return self.users[username]
ClassEval_20
from datetime import datetime class Chat: """ This is a chat class with the functions of adding users, removing users, sending messages, and obtaining messages. """ def __init__(self): """ Initialize the Chat with an attribute users, which is an empty dictionary. """ se...
import unittest class ChatTestAddUser(unittest.TestCase): def test_add_user(self): chat = Chat() self.assertEqual(chat.add_user('John'), True) self.assertEqual(chat.users, {'John': []}) def test_add_user_2(self): chat = Chat() chat.users = {'John': []} self.asser...
from datetime import datetime class Chat: def __init__(self): self.users = {} def add_user(self, username): if username in self.users: return False else: self.users[username] = [] return True def remove_user(self, username): if username ...
[ "from datetime import datetime" ]
""" This is a chat class with the functions of adding users, removing users, sending messages, and obtaining messages. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.users" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_user(self, username):\n \"\"\"\n Add a new user to the Chat.\n :param username: ...
Chat
[ "ChatTestAddUser", "ChatTestRemoveUser", "ChatTestSendMessage", "ChatTestGetMessages", "ChatTestMain" ]
class Chat: def __init__(self): """ Initialize the Chat with an attribute users, which is an empty dictionary. """ self.users = {}
[ "self.users" ]
ClassEval_20_t24
24
get_messages
def get_messages(self, username):
from datetime import datetime class Chat: def __init__(self): self.users = {} def add_user(self, username): if username in self.users: return False else: self.users[username] = [] return True def remove_user(self, username): if username ...
return self.users[username]
ClassEval_21
from datetime import datetime class Classroom: """ This is a class representing a classroom, capable of adding and removing courses, checking availability at a given time, and detecting conflicts when scheduling new courses. """ def __init__(self, id): """ Initialize the classroom mana...
import unittest from datetime import datetime class ClassroomTestAddCourse(unittest.TestCase): def test_add_course_1(self): classroom = Classroom(1) course = {'name': 'math', 'start_time': '09:00', 'end_time': '10:00'} classroom.add_course(course) self.assertIn(course, classroom.co...
from datetime import datetime class Classroom: def __init__(self, id): self.id = id self.courses = [] def add_course(self, course): if course not in self.courses: self.courses.append(course) def remove_course(self, course): if course in self.courses: ...
[ "from datetime import datetime" ]
""" This is a class representing a classroom, capable of adding and removing courses, checking availability at a given time, and detecting conflicts when scheduling new courses. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.courses" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_course(self, course):\n \"\"\"\n Add course to self.courses list if the course wasn't...
Classroom
[ "ClassroomTestAddCourse", "ClassroomTestRemoveCourse", "ClassroomTestIsFreeAt", "ClassroomTestCheckCourseConflict", "ClassroomTestMain" ]
class Classroom: def __init__(self, id): """ Initialize the classroom management system. :param id: int, the id of classroom """ self.id = id self.courses = []
[ "self.courses", "self.id" ]
ClassEval_21_t0
0
add_course
def add_course(self, course):
from datetime import datetime class Classroom: def __init__(self, id): self.id = id self.courses = [] def add_course(self, course):
if course not in self.courses:
self.courses.append(course) def remove_course(self, course): if course in self.courses: self.courses.remove(course) def is_free_at(self, check_time): check_time = datetime.strptime(check_time, '%H:%M') for course in self.courses: if datetime.strptim...
ClassEval_21
from datetime import datetime class Classroom: """ This is a class representing a classroom, capable of adding and removing courses, checking availability at a given time, and detecting conflicts when scheduling new courses. """ def __init__(self, id): """ Initialize the classroom mana...
import unittest from datetime import datetime class ClassroomTestAddCourse(unittest.TestCase): def test_add_course_1(self): classroom = Classroom(1) course = {'name': 'math', 'start_time': '09:00', 'end_time': '10:00'} classroom.add_course(course) self.assertIn(course, classroom.co...
from datetime import datetime class Classroom: def __init__(self, id): self.id = id self.courses = [] def add_course(self, course): if course not in self.courses: self.courses.append(course) def remove_course(self, course): if course in self.courses: ...
[ "from datetime import datetime" ]
""" This is a class representing a classroom, capable of adding and removing courses, checking availability at a given time, and detecting conflicts when scheduling new courses. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.courses" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_course(self, course):\n \"\"\"\n Add course to self.courses list if the course wasn't...
Classroom
[ "ClassroomTestAddCourse", "ClassroomTestRemoveCourse", "ClassroomTestIsFreeAt", "ClassroomTestCheckCourseConflict", "ClassroomTestMain" ]
class Classroom: def __init__(self, id): """ Initialize the classroom management system. :param id: int, the id of classroom """ self.id = id self.courses = []
[ "self.courses", "self.id" ]
ClassEval_21_t1
1
add_course
def add_course(self, course):
from datetime import datetime class Classroom: def __init__(self, id): self.id = id self.courses = [] def add_course(self, course): if course not in self.courses:
self.courses.append(course)
def remove_course(self, course): if course in self.courses: self.courses.remove(course) def is_free_at(self, check_time): check_time = datetime.strptime(check_time, '%H:%M') for course in self.courses: if datetime.strptime(course['start_time'], '%H:%M') <= chec...
ClassEval_21
from datetime import datetime class Classroom: """ This is a class representing a classroom, capable of adding and removing courses, checking availability at a given time, and detecting conflicts when scheduling new courses. """ def __init__(self, id): """ Initialize the classroom mana...
import unittest from datetime import datetime class ClassroomTestAddCourse(unittest.TestCase): def test_add_course_1(self): classroom = Classroom(1) course = {'name': 'math', 'start_time': '09:00', 'end_time': '10:00'} classroom.add_course(course) self.assertIn(course, classroom.co...
from datetime import datetime class Classroom: def __init__(self, id): self.id = id self.courses = [] def add_course(self, course): if course not in self.courses: self.courses.append(course) def remove_course(self, course): if course in self.courses: ...
[ "from datetime import datetime" ]
""" This is a class representing a classroom, capable of adding and removing courses, checking availability at a given time, and detecting conflicts when scheduling new courses. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.courses" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_course(self, course):\n \"\"\"\n Add course to self.courses list if the course wasn't...
Classroom
[ "ClassroomTestAddCourse", "ClassroomTestRemoveCourse", "ClassroomTestIsFreeAt", "ClassroomTestCheckCourseConflict", "ClassroomTestMain" ]
class Classroom: def __init__(self, id): """ Initialize the classroom management system. :param id: int, the id of classroom """ self.id = id self.courses = []
[ "self.courses", "self.id" ]
ClassEval_21_t2
2
remove_course
def remove_course(self, course):
from datetime import datetime class Classroom: def __init__(self, id): self.id = id self.courses = [] def add_course(self, course): if course not in self.courses: self.courses.append(course) def remove_course(self, course):
if course in self.courses:
self.courses.remove(course) def is_free_at(self, check_time): check_time = datetime.strptime(check_time, '%H:%M') for course in self.courses: if datetime.strptime(course['start_time'], '%H:%M') <= check_time <= datetime.strptime(course['end_time'], ...
ClassEval_21
from datetime import datetime class Classroom: """ This is a class representing a classroom, capable of adding and removing courses, checking availability at a given time, and detecting conflicts when scheduling new courses. """ def __init__(self, id): """ Initialize the classroom mana...
import unittest from datetime import datetime class ClassroomTestAddCourse(unittest.TestCase): def test_add_course_1(self): classroom = Classroom(1) course = {'name': 'math', 'start_time': '09:00', 'end_time': '10:00'} classroom.add_course(course) self.assertIn(course, classroom.co...
from datetime import datetime class Classroom: def __init__(self, id): self.id = id self.courses = [] def add_course(self, course): if course not in self.courses: self.courses.append(course) def remove_course(self, course): if course in self.courses: ...
[ "from datetime import datetime" ]
""" This is a class representing a classroom, capable of adding and removing courses, checking availability at a given time, and detecting conflicts when scheduling new courses. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.courses" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_course(self, course):\n \"\"\"\n Add course to self.courses list if the course wasn't...
Classroom
[ "ClassroomTestAddCourse", "ClassroomTestRemoveCourse", "ClassroomTestIsFreeAt", "ClassroomTestCheckCourseConflict", "ClassroomTestMain" ]
class Classroom: def __init__(self, id): """ Initialize the classroom management system. :param id: int, the id of classroom """ self.id = id self.courses = []
[ "self.courses", "self.id" ]
ClassEval_21_t3
3
remove_course
def remove_course(self, course):
from datetime import datetime class Classroom: def __init__(self, id): self.id = id self.courses = [] def add_course(self, course): if course not in self.courses: self.courses.append(course) def remove_course(self, course): if course in self.courses:
self.courses.remove(course)
def is_free_at(self, check_time): check_time = datetime.strptime(check_time, '%H:%M') for course in self.courses: if datetime.strptime(course['start_time'], '%H:%M') <= check_time <= datetime.strptime(course['end_time'], ...
ClassEval_21
from datetime import datetime class Classroom: """ This is a class representing a classroom, capable of adding and removing courses, checking availability at a given time, and detecting conflicts when scheduling new courses. """ def __init__(self, id): """ Initialize the classroom mana...
import unittest from datetime import datetime class ClassroomTestAddCourse(unittest.TestCase): def test_add_course_1(self): classroom = Classroom(1) course = {'name': 'math', 'start_time': '09:00', 'end_time': '10:00'} classroom.add_course(course) self.assertIn(course, classroom.co...
from datetime import datetime class Classroom: def __init__(self, id): self.id = id self.courses = [] def add_course(self, course): if course not in self.courses: self.courses.append(course) def remove_course(self, course): if course in self.courses: ...
[ "from datetime import datetime" ]
""" This is a class representing a classroom, capable of adding and removing courses, checking availability at a given time, and detecting conflicts when scheduling new courses. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.courses" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_course(self, course):\n \"\"\"\n Add course to self.courses list if the course wasn't...
Classroom
[ "ClassroomTestAddCourse", "ClassroomTestRemoveCourse", "ClassroomTestIsFreeAt", "ClassroomTestCheckCourseConflict", "ClassroomTestMain" ]
class Classroom: def __init__(self, id): """ Initialize the classroom management system. :param id: int, the id of classroom """ self.id = id self.courses = []
[ "self.courses", "self.id" ]
ClassEval_21_t4
4
is_free_at
def is_free_at(self, check_time):
from datetime import datetime class Classroom: def __init__(self, id): self.id = id self.courses = [] def add_course(self, course): if course not in self.courses: self.courses.append(course) def remove_course(self, course): if course in self.courses: ...
check_time = datetime.strptime(check_time, '%H:%M')
for course in self.courses: if datetime.strptime(course['start_time'], '%H:%M') <= check_time <= datetime.strptime(course['end_time'], '%H:%M'): return False return True d...
ClassEval_21
from datetime import datetime class Classroom: """ This is a class representing a classroom, capable of adding and removing courses, checking availability at a given time, and detecting conflicts when scheduling new courses. """ def __init__(self, id): """ Initialize the classroom mana...
import unittest from datetime import datetime class ClassroomTestAddCourse(unittest.TestCase): def test_add_course_1(self): classroom = Classroom(1) course = {'name': 'math', 'start_time': '09:00', 'end_time': '10:00'} classroom.add_course(course) self.assertIn(course, classroom.co...
from datetime import datetime class Classroom: def __init__(self, id): self.id = id self.courses = [] def add_course(self, course): if course not in self.courses: self.courses.append(course) def remove_course(self, course): if course in self.courses: ...
[ "from datetime import datetime" ]
""" This is a class representing a classroom, capable of adding and removing courses, checking availability at a given time, and detecting conflicts when scheduling new courses. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.courses" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_course(self, course):\n \"\"\"\n Add course to self.courses list if the course wasn't...
Classroom
[ "ClassroomTestAddCourse", "ClassroomTestRemoveCourse", "ClassroomTestIsFreeAt", "ClassroomTestCheckCourseConflict", "ClassroomTestMain" ]
class Classroom: def __init__(self, id): """ Initialize the classroom management system. :param id: int, the id of classroom """ self.id = id self.courses = []
[ "self.courses", "self.id" ]
ClassEval_21_t5
5
is_free_at
def is_free_at(self, check_time):
from datetime import datetime class Classroom: def __init__(self, id): self.id = id self.courses = [] def add_course(self, course): if course not in self.courses: self.courses.append(course) def remove_course(self, course): if course in self.courses: ...
for course in self.courses:
if datetime.strptime(course['start_time'], '%H:%M') <= check_time <= datetime.strptime(course['end_time'], '%H:%M'): return False return True def check_course_conflict(self, new_co...
ClassEval_21
from datetime import datetime class Classroom: """ This is a class representing a classroom, capable of adding and removing courses, checking availability at a given time, and detecting conflicts when scheduling new courses. """ def __init__(self, id): """ Initialize the classroom mana...
import unittest from datetime import datetime class ClassroomTestAddCourse(unittest.TestCase): def test_add_course_1(self): classroom = Classroom(1) course = {'name': 'math', 'start_time': '09:00', 'end_time': '10:00'} classroom.add_course(course) self.assertIn(course, classroom.co...
from datetime import datetime class Classroom: def __init__(self, id): self.id = id self.courses = [] def add_course(self, course): if course not in self.courses: self.courses.append(course) def remove_course(self, course): if course in self.courses: ...
[ "from datetime import datetime" ]
""" This is a class representing a classroom, capable of adding and removing courses, checking availability at a given time, and detecting conflicts when scheduling new courses. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.courses" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_course(self, course):\n \"\"\"\n Add course to self.courses list if the course wasn't...
Classroom
[ "ClassroomTestAddCourse", "ClassroomTestRemoveCourse", "ClassroomTestIsFreeAt", "ClassroomTestCheckCourseConflict", "ClassroomTestMain" ]
class Classroom: def __init__(self, id): """ Initialize the classroom management system. :param id: int, the id of classroom """ self.id = id self.courses = []
[ "self.courses", "self.id" ]
ClassEval_21_t6
6
is_free_at
def is_free_at(self, check_time):
from datetime import datetime class Classroom: def __init__(self, id): self.id = id self.courses = [] def add_course(self, course): if course not in self.courses: self.courses.append(course) def remove_course(self, course): if course in self.courses: ...
if datetime.strptime(course['start_time'], '%H:%M') <= check_time <= datetime.strptime(course['end_time'],
'%H:%M'): return False return True def check_course_conflict(self, new_course): new_start_time = datetime.strptime(new_course['start_time'], '%H:%M') new_end_time = datetime.st...
ClassEval_21
from datetime import datetime class Classroom: """ This is a class representing a classroom, capable of adding and removing courses, checking availability at a given time, and detecting conflicts when scheduling new courses. """ def __init__(self, id): """ Initialize the classroom mana...
import unittest from datetime import datetime class ClassroomTestAddCourse(unittest.TestCase): def test_add_course_1(self): classroom = Classroom(1) course = {'name': 'math', 'start_time': '09:00', 'end_time': '10:00'} classroom.add_course(course) self.assertIn(course, classroom.co...
from datetime import datetime class Classroom: def __init__(self, id): self.id = id self.courses = [] def add_course(self, course): if course not in self.courses: self.courses.append(course) def remove_course(self, course): if course in self.courses: ...
[ "from datetime import datetime" ]
""" This is a class representing a classroom, capable of adding and removing courses, checking availability at a given time, and detecting conflicts when scheduling new courses. """
[ { "dependencies": { "Standalone": false, "field_dependencies": [ "self.courses" ], "lib_dependencies": [], "method_dependencies": [] }, "method_description": "def add_course(self, course):\n \"\"\"\n Add course to self.courses list if the course wasn't...
Classroom
[ "ClassroomTestAddCourse", "ClassroomTestRemoveCourse", "ClassroomTestIsFreeAt", "ClassroomTestCheckCourseConflict", "ClassroomTestMain" ]
class Classroom: def __init__(self, id): """ Initialize the classroom management system. :param id: int, the id of classroom """ self.id = id self.courses = []
[ "self.courses", "self.id" ]
ClassEval_21_t7
7
is_free_at
def is_free_at(self, check_time):
from datetime import datetime class Classroom: def __init__(self, id): self.id = id self.courses = [] def add_course(self, course): if course not in self.courses: self.courses.append(course) def remove_course(self, course): if course in self.courses: ...
'%H:%M'):
return False return True def check_course_conflict(self, new_course): new_start_time = datetime.strptime(new_course['start_time'], '%H:%M') new_end_time = datetime.strptime(new_course['end_time'], '%H:%M') flag = True for course in self.courses: ...