task_id string | skeleton string | test string | solution_code string | import_statement list | class_description string | methods_info list | class_name string | test_classes list | class_constructor string | fields list | new_task_id string | method_name string | method_signature string | completion_code string |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ClassEval_0 | import logging
import datetime
class AccessGatewayFilter:
"""
This class is a filter used for accessing gateway filtering, primarily for authentication and access log recording.
"""
def __init__(self):
pass
def filter(self, request):
"""
Filter the incoming request based o... | import unittest
class AccessGatewayFilterTestFilter(unittest.TestCase):
def test_filter_1(self):
agf = AccessGatewayFilter()
request = {'path': '/api/data', 'method': 'GET'}
res = agf.filter(request)
self.assertTrue(res)
def test_filter_2(self):
agf = AccessGatewayFilte... | import logging
import datetime
class AccessGatewayFilter:
def __init__(self):
pass
def filter(self, request):
request_uri = request['path']
method = request['method']
if self.is_start_with(request_uri):
return True
try:
token = self.get_jwt_u... | [
"import logging",
"import datetime"
] | """
This class is a filter used for accessing gateway filtering, primarily for authentication and access log recording.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [],
"lib_dependencies": [],
"method_dependencies": [
"is_start_with",
"get_jwt_user",
"set_current_user_info_and_log"
]
},
"method_description": "def filter(self, request):\n \"\"\... | AccessGatewayFilter | [
"AccessGatewayFilterTestFilter",
"AccessGatewayFilterTestIsStartWith",
"AccessGatewayFilterTestGetJwtUser",
"AccessGatewayFilterTest"
] | class AccessGatewayFilter:
def __init__(self):
pass
| [] | ClassEval_0_m0 | filter | def filter(self, request): | import logging
import datetime
class AccessGatewayFilter:
def __init__(self):
pass
def is_start_with(self, request_uri):
start_with = ["/api", '/login']
for s in start_with:
if request_uri.startswith(s):
return True
return False
def get_jwt_u... |
ClassEval_0 | import logging
import datetime
class AccessGatewayFilter:
"""
This class is a filter used for accessing gateway filtering, primarily for authentication and access log recording.
"""
def __init__(self):
pass
def filter(self, request):
"""
Filter the incoming request based o... | import unittest
class AccessGatewayFilterTestFilter(unittest.TestCase):
def test_filter_1(self):
agf = AccessGatewayFilter()
request = {'path': '/api/data', 'method': 'GET'}
res = agf.filter(request)
self.assertTrue(res)
def test_filter_2(self):
agf = AccessGatewayFilte... | import logging
import datetime
class AccessGatewayFilter:
def __init__(self):
pass
def filter(self, request):
request_uri = request['path']
method = request['method']
if self.is_start_with(request_uri):
return True
try:
token = self.get_jwt_u... | [
"import logging",
"import datetime"
] | """
This class is a filter used for accessing gateway filtering, primarily for authentication and access log recording.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [],
"lib_dependencies": [],
"method_dependencies": [
"is_start_with",
"get_jwt_user",
"set_current_user_info_and_log"
]
},
"method_description": "def filter(self, request):\n \"\"\... | AccessGatewayFilter | [
"AccessGatewayFilterTestFilter",
"AccessGatewayFilterTestIsStartWith",
"AccessGatewayFilterTestGetJwtUser",
"AccessGatewayFilterTest"
] | class AccessGatewayFilter:
def __init__(self):
pass
| [] | ClassEval_0_m1 | is_start_with | def is_start_with(self, request_uri): | import logging
import datetime
class AccessGatewayFilter:
def __init__(self):
pass
def filter(self, request):
request_uri = request['path']
method = request['method']
if self.is_start_with(request_uri):
return True
try:
token = self.get_jwt_u... |
ClassEval_0 | import logging
import datetime
class AccessGatewayFilter:
"""
This class is a filter used for accessing gateway filtering, primarily for authentication and access log recording.
"""
def __init__(self):
pass
def filter(self, request):
"""
Filter the incoming request based o... | import unittest
class AccessGatewayFilterTestFilter(unittest.TestCase):
def test_filter_1(self):
agf = AccessGatewayFilter()
request = {'path': '/api/data', 'method': 'GET'}
res = agf.filter(request)
self.assertTrue(res)
def test_filter_2(self):
agf = AccessGatewayFilte... | import logging
import datetime
class AccessGatewayFilter:
def __init__(self):
pass
def filter(self, request):
request_uri = request['path']
method = request['method']
if self.is_start_with(request_uri):
return True
try:
token = self.get_jwt_u... | [
"import logging",
"import datetime"
] | """
This class is a filter used for accessing gateway filtering, primarily for authentication and access log recording.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [],
"lib_dependencies": [],
"method_dependencies": [
"is_start_with",
"get_jwt_user",
"set_current_user_info_and_log"
]
},
"method_description": "def filter(self, request):\n \"\"\... | AccessGatewayFilter | [
"AccessGatewayFilterTestFilter",
"AccessGatewayFilterTestIsStartWith",
"AccessGatewayFilterTestGetJwtUser",
"AccessGatewayFilterTest"
] | class AccessGatewayFilter:
def __init__(self):
pass
| [] | ClassEval_0_m2 | get_jwt_user | def get_jwt_user(self, request): | import logging
import datetime
class AccessGatewayFilter:
def __init__(self):
pass
def filter(self, request):
request_uri = request['path']
method = request['method']
if self.is_start_with(request_uri):
return True
try:
token = self.get_jwt_u... |
ClassEval_0 | import logging
import datetime
class AccessGatewayFilter:
"""
This class is a filter used for accessing gateway filtering, primarily for authentication and access log recording.
"""
def __init__(self):
pass
def filter(self, request):
"""
Filter the incoming request based o... | import unittest
class AccessGatewayFilterTestFilter(unittest.TestCase):
def test_filter_1(self):
agf = AccessGatewayFilter()
request = {'path': '/api/data', 'method': 'GET'}
res = agf.filter(request)
self.assertTrue(res)
def test_filter_2(self):
agf = AccessGatewayFilte... | import logging
import datetime
class AccessGatewayFilter:
def __init__(self):
pass
def filter(self, request):
request_uri = request['path']
method = request['method']
if self.is_start_with(request_uri):
return True
try:
token = self.get_jwt_u... | [
"import logging",
"import datetime"
] | """
This class is a filter used for accessing gateway filtering, primarily for authentication and access log recording.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [],
"lib_dependencies": [],
"method_dependencies": [
"is_start_with",
"get_jwt_user",
"set_current_user_info_and_log"
]
},
"method_description": "def filter(self, request):\n \"\"\... | AccessGatewayFilter | [
"AccessGatewayFilterTestFilter",
"AccessGatewayFilterTestIsStartWith",
"AccessGatewayFilterTestGetJwtUser",
"AccessGatewayFilterTest"
] | class AccessGatewayFilter:
def __init__(self):
pass
| [] | ClassEval_0_m3 | set_current_user_info_and_log | def set_current_user_info_and_log(self, user): | import logging
import datetime
class AccessGatewayFilter:
def __init__(self):
pass
def filter(self, request):
request_uri = request['path']
method = request['method']
if self.is_start_with(request_uri):
return True
try:
token = self.get_jwt_u... |
ClassEval_1 | import math
class AreaCalculator:
"""
This is a class for calculating the area of different shapes, including circle, sphere, cylinder, sector and annulus.
"""
def __init__(self, radius):
"""
Initialize the radius for shapes.
:param radius: float
"""
self.radius... | import unittest
class AreaCalculatorTestCalculateCircleArea(unittest.TestCase):
def test_calculate_circle_area(self):
areaCalculator = AreaCalculator(2)
self.assertAlmostEqual(12.56, areaCalculator.calculate_circle_area(), delta=0.01)
def test_calculate_circle_area_2(self):
areaCalculat... | import math
class AreaCalculator:
def __init__(self, radius):
self.radius = radius
def calculate_circle_area(self):
return math.pi * self.radius ** 2
def calculate_sphere_area(self):
return 4 * math.pi * self.radius ** 2
def calculate_cylinder_area(self, height):
re... | [
"import math"
] | """
This is a class for calculating the area of different shapes, including circle, sphere, cylinder, sector and annulus.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [
"self.radius"
],
"lib_dependencies": [
"math"
],
"method_dependencies": []
},
"method_description": "def calculate_circle_area(self):\n \"\"\"\n calculate the area of circle... | AreaCalculator | [
"AreaCalculatorTestCalculateCircleArea",
"AreaCalculatorTestCalculateSphereArea",
"AreaCalculatorTestCalculateCylinderArea",
"AreaCalculatorTestCalculateSectorArea",
"AreaCalculatorTestCalculateAnnulusArea",
"AreaCalculatorTestCalculateMain"
] | class AreaCalculator:
def __init__(self, radius):
"""
Initialize the radius for shapes.
:param radius: float
"""
self.radius = radius
| [
"self.radius"
] | ClassEval_1_m0 | calculate_circle_area | def calculate_circle_area(self): | import math
class AreaCalculator:
def __init__(self, radius):
self.radius = radius
def calculate_sphere_area(self):
return 4 * math.pi * self.radius ** 2
def calculate_cylinder_area(self, height):
return 2 * math.pi * self.radius * (self.radius + height)
def calculate_sect... |
ClassEval_1 | import math
class AreaCalculator:
"""
This is a class for calculating the area of different shapes, including circle, sphere, cylinder, sector and annulus.
"""
def __init__(self, radius):
"""
Initialize the radius for shapes.
:param radius: float
"""
self.radius... | import unittest
class AreaCalculatorTestCalculateCircleArea(unittest.TestCase):
def test_calculate_circle_area(self):
areaCalculator = AreaCalculator(2)
self.assertAlmostEqual(12.56, areaCalculator.calculate_circle_area(), delta=0.01)
def test_calculate_circle_area_2(self):
areaCalculat... | import math
class AreaCalculator:
def __init__(self, radius):
self.radius = radius
def calculate_circle_area(self):
return math.pi * self.radius ** 2
def calculate_sphere_area(self):
return 4 * math.pi * self.radius ** 2
def calculate_cylinder_area(self, height):
re... | [
"import math"
] | """
This is a class for calculating the area of different shapes, including circle, sphere, cylinder, sector and annulus.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [
"self.radius"
],
"lib_dependencies": [
"math"
],
"method_dependencies": []
},
"method_description": "def calculate_circle_area(self):\n \"\"\"\n calculate the area of circle... | AreaCalculator | [
"AreaCalculatorTestCalculateCircleArea",
"AreaCalculatorTestCalculateSphereArea",
"AreaCalculatorTestCalculateCylinderArea",
"AreaCalculatorTestCalculateSectorArea",
"AreaCalculatorTestCalculateAnnulusArea",
"AreaCalculatorTestCalculateMain"
] | class AreaCalculator:
def __init__(self, radius):
"""
Initialize the radius for shapes.
:param radius: float
"""
self.radius = radius
| [
"self.radius"
] | ClassEval_1_m1 | calculate_sphere_area | def calculate_sphere_area(self): | import math
class AreaCalculator:
def __init__(self, radius):
self.radius = radius
def calculate_circle_area(self):
return math.pi * self.radius ** 2
def calculate_cylinder_area(self, height):
return 2 * math.pi * self.radius * (self.radius + height)
def calculate_sector_a... |
ClassEval_1 | import math
class AreaCalculator:
"""
This is a class for calculating the area of different shapes, including circle, sphere, cylinder, sector and annulus.
"""
def __init__(self, radius):
"""
Initialize the radius for shapes.
:param radius: float
"""
self.radius... | import unittest
class AreaCalculatorTestCalculateCircleArea(unittest.TestCase):
def test_calculate_circle_area(self):
areaCalculator = AreaCalculator(2)
self.assertAlmostEqual(12.56, areaCalculator.calculate_circle_area(), delta=0.01)
def test_calculate_circle_area_2(self):
areaCalculat... | import math
class AreaCalculator:
def __init__(self, radius):
self.radius = radius
def calculate_circle_area(self):
return math.pi * self.radius ** 2
def calculate_sphere_area(self):
return 4 * math.pi * self.radius ** 2
def calculate_cylinder_area(self, height):
re... | [
"import math"
] | """
This is a class for calculating the area of different shapes, including circle, sphere, cylinder, sector and annulus.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [
"self.radius"
],
"lib_dependencies": [
"math"
],
"method_dependencies": []
},
"method_description": "def calculate_circle_area(self):\n \"\"\"\n calculate the area of circle... | AreaCalculator | [
"AreaCalculatorTestCalculateCircleArea",
"AreaCalculatorTestCalculateSphereArea",
"AreaCalculatorTestCalculateCylinderArea",
"AreaCalculatorTestCalculateSectorArea",
"AreaCalculatorTestCalculateAnnulusArea",
"AreaCalculatorTestCalculateMain"
] | class AreaCalculator:
def __init__(self, radius):
"""
Initialize the radius for shapes.
:param radius: float
"""
self.radius = radius
| [
"self.radius"
] | ClassEval_1_m2 | calculate_cylinder_area | def calculate_cylinder_area(self, height): | import math
class AreaCalculator:
def __init__(self, radius):
self.radius = radius
def calculate_circle_area(self):
return math.pi * self.radius ** 2
def calculate_sphere_area(self):
return 4 * math.pi * self.radius ** 2
def calculate_sector_area(self, angle):
retu... |
ClassEval_1 | import math
class AreaCalculator:
"""
This is a class for calculating the area of different shapes, including circle, sphere, cylinder, sector and annulus.
"""
def __init__(self, radius):
"""
Initialize the radius for shapes.
:param radius: float
"""
self.radius... | import unittest
class AreaCalculatorTestCalculateCircleArea(unittest.TestCase):
def test_calculate_circle_area(self):
areaCalculator = AreaCalculator(2)
self.assertAlmostEqual(12.56, areaCalculator.calculate_circle_area(), delta=0.01)
def test_calculate_circle_area_2(self):
areaCalculat... | import math
class AreaCalculator:
def __init__(self, radius):
self.radius = radius
def calculate_circle_area(self):
return math.pi * self.radius ** 2
def calculate_sphere_area(self):
return 4 * math.pi * self.radius ** 2
def calculate_cylinder_area(self, height):
re... | [
"import math"
] | """
This is a class for calculating the area of different shapes, including circle, sphere, cylinder, sector and annulus.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [
"self.radius"
],
"lib_dependencies": [
"math"
],
"method_dependencies": []
},
"method_description": "def calculate_circle_area(self):\n \"\"\"\n calculate the area of circle... | AreaCalculator | [
"AreaCalculatorTestCalculateCircleArea",
"AreaCalculatorTestCalculateSphereArea",
"AreaCalculatorTestCalculateCylinderArea",
"AreaCalculatorTestCalculateSectorArea",
"AreaCalculatorTestCalculateAnnulusArea",
"AreaCalculatorTestCalculateMain"
] | class AreaCalculator:
def __init__(self, radius):
"""
Initialize the radius for shapes.
:param radius: float
"""
self.radius = radius
| [
"self.radius"
] | ClassEval_1_m3 | calculate_sector_area | def calculate_sector_area(self, angle): | import math
class AreaCalculator:
def __init__(self, radius):
self.radius = radius
def calculate_circle_area(self):
return math.pi * self.radius ** 2
def calculate_sphere_area(self):
return 4 * math.pi * self.radius ** 2
def calculate_cylinder_area(self, height):
re... |
ClassEval_1 | import math
class AreaCalculator:
"""
This is a class for calculating the area of different shapes, including circle, sphere, cylinder, sector and annulus.
"""
def __init__(self, radius):
"""
Initialize the radius for shapes.
:param radius: float
"""
self.radius... | import unittest
class AreaCalculatorTestCalculateCircleArea(unittest.TestCase):
def test_calculate_circle_area(self):
areaCalculator = AreaCalculator(2)
self.assertAlmostEqual(12.56, areaCalculator.calculate_circle_area(), delta=0.01)
def test_calculate_circle_area_2(self):
areaCalculat... | import math
class AreaCalculator:
def __init__(self, radius):
self.radius = radius
def calculate_circle_area(self):
return math.pi * self.radius ** 2
def calculate_sphere_area(self):
return 4 * math.pi * self.radius ** 2
def calculate_cylinder_area(self, height):
re... | [
"import math"
] | """
This is a class for calculating the area of different shapes, including circle, sphere, cylinder, sector and annulus.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [
"self.radius"
],
"lib_dependencies": [
"math"
],
"method_dependencies": []
},
"method_description": "def calculate_circle_area(self):\n \"\"\"\n calculate the area of circle... | AreaCalculator | [
"AreaCalculatorTestCalculateCircleArea",
"AreaCalculatorTestCalculateSphereArea",
"AreaCalculatorTestCalculateCylinderArea",
"AreaCalculatorTestCalculateSectorArea",
"AreaCalculatorTestCalculateAnnulusArea",
"AreaCalculatorTestCalculateMain"
] | class AreaCalculator:
def __init__(self, radius):
"""
Initialize the radius for shapes.
:param radius: float
"""
self.radius = radius
| [
"self.radius"
] | ClassEval_1_m4 | calculate_annulus_area | def calculate_annulus_area(self, inner_radius, outer_radius): | import math
class AreaCalculator:
def __init__(self, radius):
self.radius = radius
def calculate_circle_area(self):
return math.pi * self.radius ** 2
def calculate_sphere_area(self):
return 4 * math.pi * self.radius ** 2
def calculate_cylinder_area(self, height):
re... |
ClassEval_2 | class ArgumentParser:
"""
This is a class for parsing command line arguments to a dictionary.
"""
def __init__(self):
"""
Initialize the fields.
self.arguments is a dict that stores the args in a command line
self.requried is a set that stores the required arguments
... | import unittest
class ArgumentParserTestParseArguments(unittest.TestCase):
def setUp(self):
self.parser = ArgumentParser()
# key value arguments
def test_parse_arguments_1(self):
command_str = "script --name=John --age=25"
self.parser.add_argument("name")
self.parser.add_a... | class ArgumentParser:
def __init__(self):
self.arguments = {}
self.required = set()
self.types = {}
def parse_arguments(self, command_string):
args = command_string.split()[1:]
for i in range(len(args)):
arg = args[i]
if arg.startswith('--'):
... | [] | """
This is a class for parsing command line arguments to a dictionary.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [
"self.arguments",
"self.required"
],
"lib_dependencies": [],
"method_dependencies": [
"_convert_type"
]
},
"method_description": "def parse_arguments(self, command_string):\n ... | ArgumentParser | [
"ArgumentParserTestParseArguments",
"ArgumentParserTestGetArgument",
"ArgumentParserTestAddArgument",
"ArgumentParserTestConvertType",
"ArgumentParserTestMain"
] | class ArgumentParser:
def __init__(self):
"""
Initialize the fields.
self.arguments is a dict that stores the args in a command line
self.requried is a set that stores the required arguments
self.types is a dict that stores type of every arguments.
>>> parser.argumen... | [
"self.arguments",
"self.required",
"self.types"
] | ClassEval_2_m0 | parse_arguments | def parse_arguments(self, command_string): | class ArgumentParser:
def __init__(self):
self.arguments = {}
self.required = set()
self.types = {}
def get_argument(self, key):
return self.arguments.get(key)
def add_argument(self, arg, required=False, arg_type=str):
if required:
self.required.add(arg... |
ClassEval_2 | class ArgumentParser:
"""
This is a class for parsing command line arguments to a dictionary.
"""
def __init__(self):
"""
Initialize the fields.
self.arguments is a dict that stores the args in a command line
self.requried is a set that stores the required arguments
... | import unittest
class ArgumentParserTestParseArguments(unittest.TestCase):
def setUp(self):
self.parser = ArgumentParser()
# key value arguments
def test_parse_arguments_1(self):
command_str = "script --name=John --age=25"
self.parser.add_argument("name")
self.parser.add_a... | class ArgumentParser:
def __init__(self):
self.arguments = {}
self.required = set()
self.types = {}
def parse_arguments(self, command_string):
args = command_string.split()[1:]
for i in range(len(args)):
arg = args[i]
if arg.startswith('--'):
... | [] | """
This is a class for parsing command line arguments to a dictionary.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [
"self.arguments",
"self.required"
],
"lib_dependencies": [],
"method_dependencies": [
"_convert_type"
]
},
"method_description": "def parse_arguments(self, command_string):\n ... | ArgumentParser | [
"ArgumentParserTestParseArguments",
"ArgumentParserTestGetArgument",
"ArgumentParserTestAddArgument",
"ArgumentParserTestConvertType",
"ArgumentParserTestMain"
] | class ArgumentParser:
def __init__(self):
"""
Initialize the fields.
self.arguments is a dict that stores the args in a command line
self.requried is a set that stores the required arguments
self.types is a dict that stores type of every arguments.
>>> parser.argumen... | [
"self.arguments",
"self.required",
"self.types"
] | ClassEval_2_m1 | get_argument | def get_argument(self, key): | class ArgumentParser:
def __init__(self):
self.arguments = {}
self.required = set()
self.types = {}
def parse_arguments(self, command_string):
args = command_string.split()[1:]
for i in range(len(args)):
arg = args[i]
if arg.startswith('--'):
... |
ClassEval_2 | class ArgumentParser:
"""
This is a class for parsing command line arguments to a dictionary.
"""
def __init__(self):
"""
Initialize the fields.
self.arguments is a dict that stores the args in a command line
self.requried is a set that stores the required arguments
... | import unittest
class ArgumentParserTestParseArguments(unittest.TestCase):
def setUp(self):
self.parser = ArgumentParser()
# key value arguments
def test_parse_arguments_1(self):
command_str = "script --name=John --age=25"
self.parser.add_argument("name")
self.parser.add_a... | class ArgumentParser:
def __init__(self):
self.arguments = {}
self.required = set()
self.types = {}
def parse_arguments(self, command_string):
args = command_string.split()[1:]
for i in range(len(args)):
arg = args[i]
if arg.startswith('--'):
... | [] | """
This is a class for parsing command line arguments to a dictionary.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [
"self.arguments",
"self.required"
],
"lib_dependencies": [],
"method_dependencies": [
"_convert_type"
]
},
"method_description": "def parse_arguments(self, command_string):\n ... | ArgumentParser | [
"ArgumentParserTestParseArguments",
"ArgumentParserTestGetArgument",
"ArgumentParserTestAddArgument",
"ArgumentParserTestConvertType",
"ArgumentParserTestMain"
] | class ArgumentParser:
def __init__(self):
"""
Initialize the fields.
self.arguments is a dict that stores the args in a command line
self.requried is a set that stores the required arguments
self.types is a dict that stores type of every arguments.
>>> parser.argumen... | [
"self.arguments",
"self.required",
"self.types"
] | ClassEval_2_m2 | add_argument | def add_argument(self, arg, required=False, arg_type=str): | class ArgumentParser:
def __init__(self):
self.arguments = {}
self.required = set()
self.types = {}
def parse_arguments(self, command_string):
args = command_string.split()[1:]
for i in range(len(args)):
arg = args[i]
if arg.startswith('--'):
... |
ClassEval_2 | class ArgumentParser:
"""
This is a class for parsing command line arguments to a dictionary.
"""
def __init__(self):
"""
Initialize the fields.
self.arguments is a dict that stores the args in a command line
self.requried is a set that stores the required arguments
... | import unittest
class ArgumentParserTestParseArguments(unittest.TestCase):
def setUp(self):
self.parser = ArgumentParser()
# key value arguments
def test_parse_arguments_1(self):
command_str = "script --name=John --age=25"
self.parser.add_argument("name")
self.parser.add_a... | class ArgumentParser:
def __init__(self):
self.arguments = {}
self.required = set()
self.types = {}
def parse_arguments(self, command_string):
args = command_string.split()[1:]
for i in range(len(args)):
arg = args[i]
if arg.startswith('--'):
... | [] | """
This is a class for parsing command line arguments to a dictionary.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [
"self.arguments",
"self.required"
],
"lib_dependencies": [],
"method_dependencies": [
"_convert_type"
]
},
"method_description": "def parse_arguments(self, command_string):\n ... | ArgumentParser | [
"ArgumentParserTestParseArguments",
"ArgumentParserTestGetArgument",
"ArgumentParserTestAddArgument",
"ArgumentParserTestConvertType",
"ArgumentParserTestMain"
] | class ArgumentParser:
def __init__(self):
"""
Initialize the fields.
self.arguments is a dict that stores the args in a command line
self.requried is a set that stores the required arguments
self.types is a dict that stores type of every arguments.
>>> parser.argumen... | [
"self.arguments",
"self.required",
"self.types"
] | ClassEval_2_m3 | _convert_type | def _convert_type(self, arg, value): | class ArgumentParser:
def __init__(self):
self.arguments = {}
self.required = set()
self.types = {}
def parse_arguments(self, command_string):
args = command_string.split()[1:]
for i in range(len(args)):
arg = args[i]
if arg.startswith('--'):
... |
ClassEval_3 | import itertools
class ArrangementCalculator:
"""
The Arrangement class provides permutation calculations and selection operations for a given set of data elements.
"""
def __init__(self, datas):
"""
Initializes the ArrangementCalculator object with a list of datas.
:param data... | import unittest
class ArrangementCalculatorTestCount(unittest.TestCase):
def test_count_1(self):
res = ArrangementCalculator.count(5, 3)
self.assertEqual(res, 60)
def test_count_2(self):
res = ArrangementCalculator.count(4, 3)
self.assertEqual(res, 24)
def test_count_3(se... | import itertools
class ArrangementCalculator:
def __init__(self, datas):
self.datas = datas
@staticmethod
def count(n, m=None):
if m is None or n == m:
return ArrangementCalculator.factorial(n)
else:
return ArrangementCalculator.factorial(n) // ArrangementC... | [
"import itertools"
] | """
The Arrangement class provides permutation calculations and selection operations for a given set of data elements.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [],
"lib_dependencies": [],
"method_dependencies": [
"factorial"
]
},
"method_description": "def count(n, m=None):\n \"\"\"\n Counts the number of arrangements by choosing m items from n it... | ArrangementCalculator | [
"ArrangementCalculatorTestCount",
"ArrangementCalculatorTestCountAll",
"ArrangementCalculatorTestSelect",
"ArrangementCalculatorTestSelectAll",
"ArrangementCalculatorTestFactorial",
"ArrangementCalculatorTest"
] | class ArrangementCalculator:
def __init__(self, datas):
"""
Initializes the ArrangementCalculator object with a list of datas.
:param datas: List, the data elements to be used for arrangements.
"""
self.datas = datas
| [
"self.datas"
] | ClassEval_3_m0 | count | def count(n, m=None): | import itertools
class ArrangementCalculator:
def __init__(self, datas):
self.datas = datas
@staticmethod
@staticmethod
def count_all(n):
total = 0
for i in range(1, n + 1):
total += ArrangementCalculator.count(n, i)
return total
def select(self, m=No... |
ClassEval_3 | import itertools
class ArrangementCalculator:
"""
The Arrangement class provides permutation calculations and selection operations for a given set of data elements.
"""
def __init__(self, datas):
"""
Initializes the ArrangementCalculator object with a list of datas.
:param data... | import unittest
class ArrangementCalculatorTestCount(unittest.TestCase):
def test_count_1(self):
res = ArrangementCalculator.count(5, 3)
self.assertEqual(res, 60)
def test_count_2(self):
res = ArrangementCalculator.count(4, 3)
self.assertEqual(res, 24)
def test_count_3(se... | import itertools
class ArrangementCalculator:
def __init__(self, datas):
self.datas = datas
@staticmethod
def count(n, m=None):
if m is None or n == m:
return ArrangementCalculator.factorial(n)
else:
return ArrangementCalculator.factorial(n) // ArrangementC... | [
"import itertools"
] | """
The Arrangement class provides permutation calculations and selection operations for a given set of data elements.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [],
"lib_dependencies": [],
"method_dependencies": [
"factorial"
]
},
"method_description": "def count(n, m=None):\n \"\"\"\n Counts the number of arrangements by choosing m items from n it... | ArrangementCalculator | [
"ArrangementCalculatorTestCount",
"ArrangementCalculatorTestCountAll",
"ArrangementCalculatorTestSelect",
"ArrangementCalculatorTestSelectAll",
"ArrangementCalculatorTestFactorial",
"ArrangementCalculatorTest"
] | class ArrangementCalculator:
def __init__(self, datas):
"""
Initializes the ArrangementCalculator object with a list of datas.
:param datas: List, the data elements to be used for arrangements.
"""
self.datas = datas
| [
"self.datas"
] | ClassEval_3_m1 | count_all | def count_all(n): | import itertools
class ArrangementCalculator:
def __init__(self, datas):
self.datas = datas
@staticmethod
def count(n, m=None):
if m is None or n == m:
return ArrangementCalculator.factorial(n)
else:
return ArrangementCalculator.factorial(n) // ArrangementC... |
ClassEval_3 | import itertools
class ArrangementCalculator:
"""
The Arrangement class provides permutation calculations and selection operations for a given set of data elements.
"""
def __init__(self, datas):
"""
Initializes the ArrangementCalculator object with a list of datas.
:param data... | import unittest
class ArrangementCalculatorTestCount(unittest.TestCase):
def test_count_1(self):
res = ArrangementCalculator.count(5, 3)
self.assertEqual(res, 60)
def test_count_2(self):
res = ArrangementCalculator.count(4, 3)
self.assertEqual(res, 24)
def test_count_3(se... | import itertools
class ArrangementCalculator:
def __init__(self, datas):
self.datas = datas
@staticmethod
def count(n, m=None):
if m is None or n == m:
return ArrangementCalculator.factorial(n)
else:
return ArrangementCalculator.factorial(n) // ArrangementC... | [
"import itertools"
] | """
The Arrangement class provides permutation calculations and selection operations for a given set of data elements.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [],
"lib_dependencies": [],
"method_dependencies": [
"factorial"
]
},
"method_description": "def count(n, m=None):\n \"\"\"\n Counts the number of arrangements by choosing m items from n it... | ArrangementCalculator | [
"ArrangementCalculatorTestCount",
"ArrangementCalculatorTestCountAll",
"ArrangementCalculatorTestSelect",
"ArrangementCalculatorTestSelectAll",
"ArrangementCalculatorTestFactorial",
"ArrangementCalculatorTest"
] | class ArrangementCalculator:
def __init__(self, datas):
"""
Initializes the ArrangementCalculator object with a list of datas.
:param datas: List, the data elements to be used for arrangements.
"""
self.datas = datas
| [
"self.datas"
] | ClassEval_3_m2 | select | def select(self, m=None): | import itertools
class ArrangementCalculator:
def __init__(self, datas):
self.datas = datas
@staticmethod
def count(n, m=None):
if m is None or n == m:
return ArrangementCalculator.factorial(n)
else:
return ArrangementCalculator.factorial(n) // ArrangementC... |
ClassEval_3 | import itertools
class ArrangementCalculator:
"""
The Arrangement class provides permutation calculations and selection operations for a given set of data elements.
"""
def __init__(self, datas):
"""
Initializes the ArrangementCalculator object with a list of datas.
:param data... | import unittest
class ArrangementCalculatorTestCount(unittest.TestCase):
def test_count_1(self):
res = ArrangementCalculator.count(5, 3)
self.assertEqual(res, 60)
def test_count_2(self):
res = ArrangementCalculator.count(4, 3)
self.assertEqual(res, 24)
def test_count_3(se... | import itertools
class ArrangementCalculator:
def __init__(self, datas):
self.datas = datas
@staticmethod
def count(n, m=None):
if m is None or n == m:
return ArrangementCalculator.factorial(n)
else:
return ArrangementCalculator.factorial(n) // ArrangementC... | [
"import itertools"
] | """
The Arrangement class provides permutation calculations and selection operations for a given set of data elements.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [],
"lib_dependencies": [],
"method_dependencies": [
"factorial"
]
},
"method_description": "def count(n, m=None):\n \"\"\"\n Counts the number of arrangements by choosing m items from n it... | ArrangementCalculator | [
"ArrangementCalculatorTestCount",
"ArrangementCalculatorTestCountAll",
"ArrangementCalculatorTestSelect",
"ArrangementCalculatorTestSelectAll",
"ArrangementCalculatorTestFactorial",
"ArrangementCalculatorTest"
] | class ArrangementCalculator:
def __init__(self, datas):
"""
Initializes the ArrangementCalculator object with a list of datas.
:param datas: List, the data elements to be used for arrangements.
"""
self.datas = datas
| [
"self.datas"
] | ClassEval_3_m3 | select_all | def select_all(self): | import itertools
class ArrangementCalculator:
def __init__(self, datas):
self.datas = datas
@staticmethod
def count(n, m=None):
if m is None or n == m:
return ArrangementCalculator.factorial(n)
else:
return ArrangementCalculator.factorial(n) // ArrangementC... |
ClassEval_3 | import itertools
class ArrangementCalculator:
"""
The Arrangement class provides permutation calculations and selection operations for a given set of data elements.
"""
def __init__(self, datas):
"""
Initializes the ArrangementCalculator object with a list of datas.
:param data... | import unittest
class ArrangementCalculatorTestCount(unittest.TestCase):
def test_count_1(self):
res = ArrangementCalculator.count(5, 3)
self.assertEqual(res, 60)
def test_count_2(self):
res = ArrangementCalculator.count(4, 3)
self.assertEqual(res, 24)
def test_count_3(se... | import itertools
class ArrangementCalculator:
def __init__(self, datas):
self.datas = datas
@staticmethod
def count(n, m=None):
if m is None or n == m:
return ArrangementCalculator.factorial(n)
else:
return ArrangementCalculator.factorial(n) // ArrangementC... | [
"import itertools"
] | """
The Arrangement class provides permutation calculations and selection operations for a given set of data elements.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [],
"lib_dependencies": [],
"method_dependencies": [
"factorial"
]
},
"method_description": "def count(n, m=None):\n \"\"\"\n Counts the number of arrangements by choosing m items from n it... | ArrangementCalculator | [
"ArrangementCalculatorTestCount",
"ArrangementCalculatorTestCountAll",
"ArrangementCalculatorTestSelect",
"ArrangementCalculatorTestSelectAll",
"ArrangementCalculatorTestFactorial",
"ArrangementCalculatorTest"
] | class ArrangementCalculator:
def __init__(self, datas):
"""
Initializes the ArrangementCalculator object with a list of datas.
:param datas: List, the data elements to be used for arrangements.
"""
self.datas = datas
| [
"self.datas"
] | ClassEval_3_m4 | factorial | def factorial(n): | import itertools
class ArrangementCalculator:
def __init__(self, datas):
self.datas = datas
@staticmethod
def count(n, m=None):
if m is None or n == m:
return ArrangementCalculator.factorial(n)
else:
return ArrangementCalculator.factorial(n) // ArrangementC... |
ClassEval_4 | class AssessmentSystem:
"""
This is a class as an student assessment system, which supports add student, add course score, calculate GPA, and other functions for students and courses.
"""
def __init__(self):
"""
Initialize the students dict in assessment system.
"""
self... | import unittest
class AssessmentSystemTestAddStudent(unittest.TestCase):
def test_add_student(self):
assessment_system = AssessmentSystem()
assessment_system.add_student("Alice", 3, "Mathematics")
self.assertEqual(assessment_system.students["Alice"],
{'name': 'Alice... | class AssessmentSystem:
def __init__(self):
self.students = {}
def add_student(self, name, grade, major):
self.students[name] = {'name': name, 'grade': grade, 'major': major, 'courses': {}}
def add_course_score(self, name, course, score):
if name in self.students:
self.... | [] | """
This is a class as an student assessment system, which supports add student, add course score, calculate GPA, and other functions for students and courses.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [
"self.students"
],
"lib_dependencies": [],
"method_dependencies": []
},
"method_description": "def add_student(self, name, grade, major):\n \"\"\"\n Add a new student into self.students d... | AssessmentSystem | [
"AssessmentSystemTestAddStudent",
"AssessmentSystemTestAddCourseScore",
"AssessmentSystemTestGetGPA",
"AssessmentSystemTestGetAllStudentsWithFailCourse",
"AssessmentSystemTestGetCourseAverage",
"AssessmentSystemTestGetTopStudent",
"AssessmentSystemTestMain"
] | class AssessmentSystem:
def __init__(self):
"""
Initialize the students dict in assessment system.
"""
self.students = {}
| [
"self.students"
] | ClassEval_4_m0 | add_student | def add_student(self, name, grade, major): | class AssessmentSystem:
def __init__(self):
self.students = {}
def add_course_score(self, name, course, score):
if name in self.students:
self.students[name]['courses'][course] = score
def get_gpa(self, name):
if name in self.students and self.students[name]['courses']... |
ClassEval_4 | class AssessmentSystem:
"""
This is a class as an student assessment system, which supports add student, add course score, calculate GPA, and other functions for students and courses.
"""
def __init__(self):
"""
Initialize the students dict in assessment system.
"""
self... | import unittest
class AssessmentSystemTestAddStudent(unittest.TestCase):
def test_add_student(self):
assessment_system = AssessmentSystem()
assessment_system.add_student("Alice", 3, "Mathematics")
self.assertEqual(assessment_system.students["Alice"],
{'name': 'Alice... | class AssessmentSystem:
def __init__(self):
self.students = {}
def add_student(self, name, grade, major):
self.students[name] = {'name': name, 'grade': grade, 'major': major, 'courses': {}}
def add_course_score(self, name, course, score):
if name in self.students:
self.... | [] | """
This is a class as an student assessment system, which supports add student, add course score, calculate GPA, and other functions for students and courses.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [
"self.students"
],
"lib_dependencies": [],
"method_dependencies": []
},
"method_description": "def add_student(self, name, grade, major):\n \"\"\"\n Add a new student into self.students d... | AssessmentSystem | [
"AssessmentSystemTestAddStudent",
"AssessmentSystemTestAddCourseScore",
"AssessmentSystemTestGetGPA",
"AssessmentSystemTestGetAllStudentsWithFailCourse",
"AssessmentSystemTestGetCourseAverage",
"AssessmentSystemTestGetTopStudent",
"AssessmentSystemTestMain"
] | class AssessmentSystem:
def __init__(self):
"""
Initialize the students dict in assessment system.
"""
self.students = {}
| [
"self.students"
] | ClassEval_4_m1 | add_course_score | def add_course_score(self, name, course, score): | class AssessmentSystem:
def __init__(self):
self.students = {}
def add_student(self, name, grade, major):
self.students[name] = {'name': name, 'grade': grade, 'major': major, 'courses': {}}
def get_gpa(self, name):
if name in self.students and self.students[name]['courses']:
... |
ClassEval_4 | class AssessmentSystem:
"""
This is a class as an student assessment system, which supports add student, add course score, calculate GPA, and other functions for students and courses.
"""
def __init__(self):
"""
Initialize the students dict in assessment system.
"""
self... | import unittest
class AssessmentSystemTestAddStudent(unittest.TestCase):
def test_add_student(self):
assessment_system = AssessmentSystem()
assessment_system.add_student("Alice", 3, "Mathematics")
self.assertEqual(assessment_system.students["Alice"],
{'name': 'Alice... | class AssessmentSystem:
def __init__(self):
self.students = {}
def add_student(self, name, grade, major):
self.students[name] = {'name': name, 'grade': grade, 'major': major, 'courses': {}}
def add_course_score(self, name, course, score):
if name in self.students:
self.... | [] | """
This is a class as an student assessment system, which supports add student, add course score, calculate GPA, and other functions for students and courses.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [
"self.students"
],
"lib_dependencies": [],
"method_dependencies": []
},
"method_description": "def add_student(self, name, grade, major):\n \"\"\"\n Add a new student into self.students d... | AssessmentSystem | [
"AssessmentSystemTestAddStudent",
"AssessmentSystemTestAddCourseScore",
"AssessmentSystemTestGetGPA",
"AssessmentSystemTestGetAllStudentsWithFailCourse",
"AssessmentSystemTestGetCourseAverage",
"AssessmentSystemTestGetTopStudent",
"AssessmentSystemTestMain"
] | class AssessmentSystem:
def __init__(self):
"""
Initialize the students dict in assessment system.
"""
self.students = {}
| [
"self.students"
] | ClassEval_4_m2 | get_gpa | def get_gpa(self, name): | class AssessmentSystem:
def __init__(self):
self.students = {}
def add_student(self, name, grade, major):
self.students[name] = {'name': name, 'grade': grade, 'major': major, 'courses': {}}
def add_course_score(self, name, course, score):
if name in self.students:
self.... |
ClassEval_4 | class AssessmentSystem:
"""
This is a class as an student assessment system, which supports add student, add course score, calculate GPA, and other functions for students and courses.
"""
def __init__(self):
"""
Initialize the students dict in assessment system.
"""
self... | import unittest
class AssessmentSystemTestAddStudent(unittest.TestCase):
def test_add_student(self):
assessment_system = AssessmentSystem()
assessment_system.add_student("Alice", 3, "Mathematics")
self.assertEqual(assessment_system.students["Alice"],
{'name': 'Alice... | class AssessmentSystem:
def __init__(self):
self.students = {}
def add_student(self, name, grade, major):
self.students[name] = {'name': name, 'grade': grade, 'major': major, 'courses': {}}
def add_course_score(self, name, course, score):
if name in self.students:
self.... | [] | """
This is a class as an student assessment system, which supports add student, add course score, calculate GPA, and other functions for students and courses.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [
"self.students"
],
"lib_dependencies": [],
"method_dependencies": []
},
"method_description": "def add_student(self, name, grade, major):\n \"\"\"\n Add a new student into self.students d... | AssessmentSystem | [
"AssessmentSystemTestAddStudent",
"AssessmentSystemTestAddCourseScore",
"AssessmentSystemTestGetGPA",
"AssessmentSystemTestGetAllStudentsWithFailCourse",
"AssessmentSystemTestGetCourseAverage",
"AssessmentSystemTestGetTopStudent",
"AssessmentSystemTestMain"
] | class AssessmentSystem:
def __init__(self):
"""
Initialize the students dict in assessment system.
"""
self.students = {}
| [
"self.students"
] | ClassEval_4_m3 | get_all_students_with_fail_course | def get_all_students_with_fail_course(self): | class AssessmentSystem:
def __init__(self):
self.students = {}
def add_student(self, name, grade, major):
self.students[name] = {'name': name, 'grade': grade, 'major': major, 'courses': {}}
def add_course_score(self, name, course, score):
if name in self.students:
self.... |
ClassEval_4 | class AssessmentSystem:
"""
This is a class as an student assessment system, which supports add student, add course score, calculate GPA, and other functions for students and courses.
"""
def __init__(self):
"""
Initialize the students dict in assessment system.
"""
self... | import unittest
class AssessmentSystemTestAddStudent(unittest.TestCase):
def test_add_student(self):
assessment_system = AssessmentSystem()
assessment_system.add_student("Alice", 3, "Mathematics")
self.assertEqual(assessment_system.students["Alice"],
{'name': 'Alice... | class AssessmentSystem:
def __init__(self):
self.students = {}
def add_student(self, name, grade, major):
self.students[name] = {'name': name, 'grade': grade, 'major': major, 'courses': {}}
def add_course_score(self, name, course, score):
if name in self.students:
self.... | [] | """
This is a class as an student assessment system, which supports add student, add course score, calculate GPA, and other functions for students and courses.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [
"self.students"
],
"lib_dependencies": [],
"method_dependencies": []
},
"method_description": "def add_student(self, name, grade, major):\n \"\"\"\n Add a new student into self.students d... | AssessmentSystem | [
"AssessmentSystemTestAddStudent",
"AssessmentSystemTestAddCourseScore",
"AssessmentSystemTestGetGPA",
"AssessmentSystemTestGetAllStudentsWithFailCourse",
"AssessmentSystemTestGetCourseAverage",
"AssessmentSystemTestGetTopStudent",
"AssessmentSystemTestMain"
] | class AssessmentSystem:
def __init__(self):
"""
Initialize the students dict in assessment system.
"""
self.students = {}
| [
"self.students"
] | ClassEval_4_m4 | get_course_average | def get_course_average(self, course): | class AssessmentSystem:
def __init__(self):
self.students = {}
def add_student(self, name, grade, major):
self.students[name] = {'name': name, 'grade': grade, 'major': major, 'courses': {}}
def add_course_score(self, name, course, score):
if name in self.students:
self.... |
ClassEval_4 | class AssessmentSystem:
"""
This is a class as an student assessment system, which supports add student, add course score, calculate GPA, and other functions for students and courses.
"""
def __init__(self):
"""
Initialize the students dict in assessment system.
"""
self... | import unittest
class AssessmentSystemTestAddStudent(unittest.TestCase):
def test_add_student(self):
assessment_system = AssessmentSystem()
assessment_system.add_student("Alice", 3, "Mathematics")
self.assertEqual(assessment_system.students["Alice"],
{'name': 'Alice... | class AssessmentSystem:
def __init__(self):
self.students = {}
def add_student(self, name, grade, major):
self.students[name] = {'name': name, 'grade': grade, 'major': major, 'courses': {}}
def add_course_score(self, name, course, score):
if name in self.students:
self.... | [] | """
This is a class as an student assessment system, which supports add student, add course score, calculate GPA, and other functions for students and courses.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [
"self.students"
],
"lib_dependencies": [],
"method_dependencies": []
},
"method_description": "def add_student(self, name, grade, major):\n \"\"\"\n Add a new student into self.students d... | AssessmentSystem | [
"AssessmentSystemTestAddStudent",
"AssessmentSystemTestAddCourseScore",
"AssessmentSystemTestGetGPA",
"AssessmentSystemTestGetAllStudentsWithFailCourse",
"AssessmentSystemTestGetCourseAverage",
"AssessmentSystemTestGetTopStudent",
"AssessmentSystemTestMain"
] | class AssessmentSystem:
def __init__(self):
"""
Initialize the students dict in assessment system.
"""
self.students = {}
| [
"self.students"
] | ClassEval_4_m5 | get_top_student | def get_top_student(self): | class AssessmentSystem:
def __init__(self):
self.students = {}
def add_student(self, name, grade, major):
self.students[name] = {'name': name, 'grade': grade, 'major': major, 'courses': {}}
def add_course_score(self, name, course, score):
if name in self.students:
self.... |
ClassEval_6 | class AvgPartition:
"""
This is a class that partitions the given list into different blocks by specifying the number of partitions, with each block having a uniformly distributed length.
"""
def __init__(self, lst, limit):
"""
Initialize the class with the given list and the number of ... | import unittest
class AvgPartitionTestSetNum(unittest.TestCase):
def test_setNum(self):
a = AvgPartition([1, 2, 3, 4], 2)
self.assertEqual(a.setNum(), (2, 0))
def test_setNum_2(self):
a = AvgPartition([1, 2, 3, 4, 5], 2)
self.assertEqual(a.setNum(), (2, 1))
def test_setNum... | class AvgPartition:
def __init__(self, lst, limit):
self.lst = lst
self.limit = limit
def setNum(self):
size = len(self.lst) // self.limit
remainder = len(self.lst) % self.limit
return size, remainder
def get(self, index):
size, remainder = self.set... | [] | """
This is a class that partitions the given list into different blocks by specifying the number of partitions, with each block having a uniformly distributed length.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [
"self.limit",
"self.lst"
],
"lib_dependencies": [],
"method_dependencies": []
},
"method_description": "def setNum(self):\n \"\"\"\n Calculate the size of each block and the remai... | AvgPartition | [
"AvgPartitionTestSetNum",
"AvgPartitionTestGet",
"AvgPartitionTestMain"
] | class AvgPartition:
def __init__(self, lst, limit):
"""
Initialize the class with the given list and the number of partitions, and check if the number of partitions is greater than 0.
"""
self.lst = lst
self.limit = limit
| [
"self.limit",
"self.lst"
] | ClassEval_6_m0 | setNum | def setNum(self): | class AvgPartition:
def __init__(self, lst, limit):
self.lst = lst
self.limit = limit
def get(self, index):
size, remainder = self.setNum()
start = index * size + min(index, remainder)
end = start + size
if index + 1 <= remainder:
end += 1
... |
ClassEval_6 | class AvgPartition:
"""
This is a class that partitions the given list into different blocks by specifying the number of partitions, with each block having a uniformly distributed length.
"""
def __init__(self, lst, limit):
"""
Initialize the class with the given list and the number of ... | import unittest
class AvgPartitionTestSetNum(unittest.TestCase):
def test_setNum(self):
a = AvgPartition([1, 2, 3, 4], 2)
self.assertEqual(a.setNum(), (2, 0))
def test_setNum_2(self):
a = AvgPartition([1, 2, 3, 4, 5], 2)
self.assertEqual(a.setNum(), (2, 1))
def test_setNum... | class AvgPartition:
def __init__(self, lst, limit):
self.lst = lst
self.limit = limit
def setNum(self):
size = len(self.lst) // self.limit
remainder = len(self.lst) % self.limit
return size, remainder
def get(self, index):
size, remainder = self.set... | [] | """
This is a class that partitions the given list into different blocks by specifying the number of partitions, with each block having a uniformly distributed length.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [
"self.limit",
"self.lst"
],
"lib_dependencies": [],
"method_dependencies": []
},
"method_description": "def setNum(self):\n \"\"\"\n Calculate the size of each block and the remai... | AvgPartition | [
"AvgPartitionTestSetNum",
"AvgPartitionTestGet",
"AvgPartitionTestMain"
] | class AvgPartition:
def __init__(self, lst, limit):
"""
Initialize the class with the given list and the number of partitions, and check if the number of partitions is greater than 0.
"""
self.lst = lst
self.limit = limit
| [
"self.limit",
"self.lst"
] | ClassEval_6_m1 | get | def get(self, index): | class AvgPartition:
def __init__(self, lst, limit):
self.lst = lst
self.limit = limit
def setNum(self):
size = len(self.lst) // self.limit
remainder = len(self.lst) % self.limit
return size, remainder
def get(self, index):
"""
calculate the ... |
ClassEval_7 | class BalancedBrackets:
"""
This is a class that checks for bracket matching
"""
def __init__(self, expr):
"""
Initializes the class with an expression.
:param expr: The expression to check for balanced brackets,str.
"""
self.stack = []
self.left_brackets... | import unittest
class BalancedBracketsTestClearExpr(unittest.TestCase):
def test_clear_expr(self):
b = BalancedBrackets("a(b)c")
b.clear_expr()
self.assertEqual(b.expr, "()")
def test_clear_expr_2(self):
b = BalancedBrackets("a(b){c}")
b.clear_expr()
self.asser... | class BalancedBrackets:
def __init__(self, expr):
self.stack = []
self.left_brackets = ["(", "{", "["]
self.right_brackets = [")", "}", "]"]
self.expr = expr
def clear_expr(self):
self.expr = ''.join(c for c in self.expr if (c in self.left_brackets or c in self.right_bra... | [] | """
This is a class that checks for bracket matching
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [
"self.expr",
"self.left_brackets",
"self.right_brackets"
],
"lib_dependencies": [],
"method_dependencies": []
},
"method_description": "def clear_expr(self):\n \"\"\"\n Cl... | BalancedBrackets | [
"BalancedBracketsTestClearExpr",
"BalancedBracketsTestCheckBalancedBrackets",
"BalancedBracketsTestMain"
] | class BalancedBrackets:
def __init__(self, expr):
"""
Initializes the class with an expression.
:param expr: The expression to check for balanced brackets,str.
"""
self.stack = []
self.left_brackets = ["(", "{", "["]
self.right_brackets = [")", "}", "]"]
... | [
"self.expr",
"self.left_brackets",
"self.right_brackets",
"self.stack"
] | ClassEval_7_m0 | clear_expr | def clear_expr(self): | class BalancedBrackets:
def __init__(self, expr):
self.stack = []
self.left_brackets = ["(", "{", "["]
self.right_brackets = [")", "}", "]"]
self.expr = expr
def check_balanced_brackets(self):
self.clear_expr()
for Brkt in self.expr:
if Brkt in self.... |
ClassEval_7 | class BalancedBrackets:
"""
This is a class that checks for bracket matching
"""
def __init__(self, expr):
"""
Initializes the class with an expression.
:param expr: The expression to check for balanced brackets,str.
"""
self.stack = []
self.left_brackets... | import unittest
class BalancedBracketsTestClearExpr(unittest.TestCase):
def test_clear_expr(self):
b = BalancedBrackets("a(b)c")
b.clear_expr()
self.assertEqual(b.expr, "()")
def test_clear_expr_2(self):
b = BalancedBrackets("a(b){c}")
b.clear_expr()
self.asser... | class BalancedBrackets:
def __init__(self, expr):
self.stack = []
self.left_brackets = ["(", "{", "["]
self.right_brackets = [")", "}", "]"]
self.expr = expr
def clear_expr(self):
self.expr = ''.join(c for c in self.expr if (c in self.left_brackets or c in self.right_bra... | [] | """
This is a class that checks for bracket matching
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [
"self.expr",
"self.left_brackets",
"self.right_brackets"
],
"lib_dependencies": [],
"method_dependencies": []
},
"method_description": "def clear_expr(self):\n \"\"\"\n Cl... | BalancedBrackets | [
"BalancedBracketsTestClearExpr",
"BalancedBracketsTestCheckBalancedBrackets",
"BalancedBracketsTestMain"
] | class BalancedBrackets:
def __init__(self, expr):
"""
Initializes the class with an expression.
:param expr: The expression to check for balanced brackets,str.
"""
self.stack = []
self.left_brackets = ["(", "{", "["]
self.right_brackets = [")", "}", "]"]
... | [
"self.expr",
"self.left_brackets",
"self.right_brackets",
"self.stack"
] | ClassEval_7_m1 | check_balanced_brackets | def check_balanced_brackets(self): | class BalancedBrackets:
def __init__(self, expr):
self.stack = []
self.left_brackets = ["(", "{", "["]
self.right_brackets = [")", "}", "]"]
self.expr = expr
def clear_expr(self):
self.expr = ''.join(c for c in self.expr if (c in self.left_brackets or c in self.right_bra... |
ClassEval_8 | class BankAccount:
"""
This is a class as a bank account system, which supports deposit money, withdraw money, view balance, and transfer money.
"""
def __init__(self, balance=0):
"""
Initializes a bank account object with an attribute balance, default value is 0.
"""
se... | import unittest
class BankAccountTestDeposit(unittest.TestCase):
def test_deposit(self):
account1 = BankAccount()
ret = account1.deposit(1000)
self.assertEqual(ret, 1000)
def test_deposit_2(self):
account1 = BankAccount()
account1.deposit(1000)
ret = account1.d... | class BankAccount:
def __init__(self, balance=0):
self.balance = balance
def deposit(self, amount):
if amount < 0:
raise ValueError("Invalid amount")
self.balance += amount
return self.balance
def withdraw(self, amount):
if amount < 0:
raise ... | [] | """
This is a class as a bank account system, which supports deposit money, withdraw money, view balance, and transfer money.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [
"self.balance"
],
"lib_dependencies": [],
"method_dependencies": []
},
"method_description": "def deposit(self, amount):\n \"\"\"\n Deposits a certain amount into the account, increasing ... | BankAccount | [
"BankAccountTestDeposit",
"BankAccountTestWithdraw",
"BankAccountTestViewBalance",
"BankAccountTestTransfer",
"BankAccountTest"
] | class BankAccount:
def __init__(self, balance=0):
"""
Initializes a bank account object with an attribute balance, default value is 0.
"""
self.balance = balance
| [
"self.balance"
] | ClassEval_8_m0 | deposit | def deposit(self, amount): | class BankAccount:
def __init__(self, balance=0):
self.balance = balance
def withdraw(self, amount):
if amount < 0:
raise ValueError("Invalid amount")
if amount > self.balance:
raise ValueError("Insufficient balance.")
self.balance -= amount
retu... |
ClassEval_8 | class BankAccount:
"""
This is a class as a bank account system, which supports deposit money, withdraw money, view balance, and transfer money.
"""
def __init__(self, balance=0):
"""
Initializes a bank account object with an attribute balance, default value is 0.
"""
se... | import unittest
class BankAccountTestDeposit(unittest.TestCase):
def test_deposit(self):
account1 = BankAccount()
ret = account1.deposit(1000)
self.assertEqual(ret, 1000)
def test_deposit_2(self):
account1 = BankAccount()
account1.deposit(1000)
ret = account1.d... | class BankAccount:
def __init__(self, balance=0):
self.balance = balance
def deposit(self, amount):
if amount < 0:
raise ValueError("Invalid amount")
self.balance += amount
return self.balance
def withdraw(self, amount):
if amount < 0:
raise ... | [] | """
This is a class as a bank account system, which supports deposit money, withdraw money, view balance, and transfer money.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [
"self.balance"
],
"lib_dependencies": [],
"method_dependencies": []
},
"method_description": "def deposit(self, amount):\n \"\"\"\n Deposits a certain amount into the account, increasing ... | BankAccount | [
"BankAccountTestDeposit",
"BankAccountTestWithdraw",
"BankAccountTestViewBalance",
"BankAccountTestTransfer",
"BankAccountTest"
] | class BankAccount:
def __init__(self, balance=0):
"""
Initializes a bank account object with an attribute balance, default value is 0.
"""
self.balance = balance
| [
"self.balance"
] | ClassEval_8_m1 | withdraw | def withdraw(self, amount): | class BankAccount:
def __init__(self, balance=0):
self.balance = balance
def deposit(self, amount):
if amount < 0:
raise ValueError("Invalid amount")
self.balance += amount
return self.balance
def view_balance(self):
return self.balance
def transfe... |
ClassEval_8 | class BankAccount:
"""
This is a class as a bank account system, which supports deposit money, withdraw money, view balance, and transfer money.
"""
def __init__(self, balance=0):
"""
Initializes a bank account object with an attribute balance, default value is 0.
"""
se... | import unittest
class BankAccountTestDeposit(unittest.TestCase):
def test_deposit(self):
account1 = BankAccount()
ret = account1.deposit(1000)
self.assertEqual(ret, 1000)
def test_deposit_2(self):
account1 = BankAccount()
account1.deposit(1000)
ret = account1.d... | class BankAccount:
def __init__(self, balance=0):
self.balance = balance
def deposit(self, amount):
if amount < 0:
raise ValueError("Invalid amount")
self.balance += amount
return self.balance
def withdraw(self, amount):
if amount < 0:
raise ... | [] | """
This is a class as a bank account system, which supports deposit money, withdraw money, view balance, and transfer money.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [
"self.balance"
],
"lib_dependencies": [],
"method_dependencies": []
},
"method_description": "def deposit(self, amount):\n \"\"\"\n Deposits a certain amount into the account, increasing ... | BankAccount | [
"BankAccountTestDeposit",
"BankAccountTestWithdraw",
"BankAccountTestViewBalance",
"BankAccountTestTransfer",
"BankAccountTest"
] | class BankAccount:
def __init__(self, balance=0):
"""
Initializes a bank account object with an attribute balance, default value is 0.
"""
self.balance = balance
| [
"self.balance"
] | ClassEval_8_m2 | view_balance | def view_balance(self): | class BankAccount:
def __init__(self, balance=0):
self.balance = balance
def deposit(self, amount):
if amount < 0:
raise ValueError("Invalid amount")
self.balance += amount
return self.balance
def withdraw(self, amount):
if amount < 0:
raise ... |
ClassEval_8 | class BankAccount:
"""
This is a class as a bank account system, which supports deposit money, withdraw money, view balance, and transfer money.
"""
def __init__(self, balance=0):
"""
Initializes a bank account object with an attribute balance, default value is 0.
"""
se... | import unittest
class BankAccountTestDeposit(unittest.TestCase):
def test_deposit(self):
account1 = BankAccount()
ret = account1.deposit(1000)
self.assertEqual(ret, 1000)
def test_deposit_2(self):
account1 = BankAccount()
account1.deposit(1000)
ret = account1.d... | class BankAccount:
def __init__(self, balance=0):
self.balance = balance
def deposit(self, amount):
if amount < 0:
raise ValueError("Invalid amount")
self.balance += amount
return self.balance
def withdraw(self, amount):
if amount < 0:
raise ... | [] | """
This is a class as a bank account system, which supports deposit money, withdraw money, view balance, and transfer money.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [
"self.balance"
],
"lib_dependencies": [],
"method_dependencies": []
},
"method_description": "def deposit(self, amount):\n \"\"\"\n Deposits a certain amount into the account, increasing ... | BankAccount | [
"BankAccountTestDeposit",
"BankAccountTestWithdraw",
"BankAccountTestViewBalance",
"BankAccountTestTransfer",
"BankAccountTest"
] | class BankAccount:
def __init__(self, balance=0):
"""
Initializes a bank account object with an attribute balance, default value is 0.
"""
self.balance = balance
| [
"self.balance"
] | ClassEval_8_m3 | transfer | def transfer(self, other_account, amount): | class BankAccount:
def __init__(self, balance=0):
self.balance = balance
def deposit(self, amount):
if amount < 0:
raise ValueError("Invalid amount")
self.balance += amount
return self.balance
def withdraw(self, amount):
if amount < 0:
raise ... |
ClassEval_9 | class BigNumCalculator:
"""
This is a class that implements big number calculations, including adding, subtracting and multiplying.
"""
@staticmethod
def add(num1, num2):
"""
Adds two big numbers.
:param num1: The first number to add,str.
:param num2: The second numb... | import unittest
class BigNumCalculatorTestAdd(unittest.TestCase):
def test_add(self):
bigNum = BigNumCalculator()
self.assertEqual(bigNum.add("12345678901234567890", "98765432109876543210"), "111111111011111111100")
def test_add_2(self):
bigNum = BigNumCalculator()
self.assertE... | class BigNumCalculator:
@staticmethod
def add(num1, num2):
max_length = max(len(num1), len(num2))
num1 = num1.zfill(max_length)
num2 = num2.zfill(max_length)
carry = 0
result = []
for i in range(max_length - 1, -1, -1):
digit_sum = int(num1[i]) + int(... | [] | """
This is a class that implements big number calculations, including adding, subtracting and multiplying.
"""
| [
{
"dependencies": {
"Standalone": true,
"field_dependencies": [],
"lib_dependencies": [],
"method_dependencies": []
},
"method_description": "def add(num1, num2):\n \"\"\"\n Adds two big numbers.\n :param num1: The first number to add,str.\n :param num... | BigNumCalculator | [
"BigNumCalculatorTestAdd",
"BigNumCalculatorTestSubtract",
"BigNumCalculatorTestMultiply",
"BigNumCalculatorTestMain"
] | class BigNumCalculator:
| [] | ClassEval_9_m0 | add | def add(num1, num2): | class BigNumCalculator:
@staticmethod
@staticmethod
def subtract(num1, num2):
if len(num1) < len(num2):
num1, num2 = num2, num1
negative = True
elif len(num1) > len(num2):
negative = False
else:
if num1 < num2:
num1, n... |
ClassEval_9 | class BigNumCalculator:
"""
This is a class that implements big number calculations, including adding, subtracting and multiplying.
"""
@staticmethod
def add(num1, num2):
"""
Adds two big numbers.
:param num1: The first number to add,str.
:param num2: The second numb... | import unittest
class BigNumCalculatorTestAdd(unittest.TestCase):
def test_add(self):
bigNum = BigNumCalculator()
self.assertEqual(bigNum.add("12345678901234567890", "98765432109876543210"), "111111111011111111100")
def test_add_2(self):
bigNum = BigNumCalculator()
self.assertE... | class BigNumCalculator:
@staticmethod
def add(num1, num2):
max_length = max(len(num1), len(num2))
num1 = num1.zfill(max_length)
num2 = num2.zfill(max_length)
carry = 0
result = []
for i in range(max_length - 1, -1, -1):
digit_sum = int(num1[i]) + int(... | [] | """
This is a class that implements big number calculations, including adding, subtracting and multiplying.
"""
| [
{
"dependencies": {
"Standalone": true,
"field_dependencies": [],
"lib_dependencies": [],
"method_dependencies": []
},
"method_description": "def add(num1, num2):\n \"\"\"\n Adds two big numbers.\n :param num1: The first number to add,str.\n :param num... | BigNumCalculator | [
"BigNumCalculatorTestAdd",
"BigNumCalculatorTestSubtract",
"BigNumCalculatorTestMultiply",
"BigNumCalculatorTestMain"
] | class BigNumCalculator:
| [] | ClassEval_9_m1 | subtract | def subtract(num1, num2): | class BigNumCalculator:
@staticmethod
def add(num1, num2):
max_length = max(len(num1), len(num2))
num1 = num1.zfill(max_length)
num2 = num2.zfill(max_length)
carry = 0
result = []
for i in range(max_length - 1, -1, -1):
digit_sum = int(num1[i]) + int(... |
ClassEval_9 | class BigNumCalculator:
"""
This is a class that implements big number calculations, including adding, subtracting and multiplying.
"""
@staticmethod
def add(num1, num2):
"""
Adds two big numbers.
:param num1: The first number to add,str.
:param num2: The second numb... | import unittest
class BigNumCalculatorTestAdd(unittest.TestCase):
def test_add(self):
bigNum = BigNumCalculator()
self.assertEqual(bigNum.add("12345678901234567890", "98765432109876543210"), "111111111011111111100")
def test_add_2(self):
bigNum = BigNumCalculator()
self.assertE... | class BigNumCalculator:
@staticmethod
def add(num1, num2):
max_length = max(len(num1), len(num2))
num1 = num1.zfill(max_length)
num2 = num2.zfill(max_length)
carry = 0
result = []
for i in range(max_length - 1, -1, -1):
digit_sum = int(num1[i]) + int(... | [] | """
This is a class that implements big number calculations, including adding, subtracting and multiplying.
"""
| [
{
"dependencies": {
"Standalone": true,
"field_dependencies": [],
"lib_dependencies": [],
"method_dependencies": []
},
"method_description": "def add(num1, num2):\n \"\"\"\n Adds two big numbers.\n :param num1: The first number to add,str.\n :param num... | BigNumCalculator | [
"BigNumCalculatorTestAdd",
"BigNumCalculatorTestSubtract",
"BigNumCalculatorTestMultiply",
"BigNumCalculatorTestMain"
] | class BigNumCalculator:
| [] | ClassEval_9_m2 | multiply | def multiply(num1, num2): | class BigNumCalculator:
@staticmethod
def add(num1, num2):
max_length = max(len(num1), len(num2))
num1 = num1.zfill(max_length)
num2 = num2.zfill(max_length)
carry = 0
result = []
for i in range(max_length - 1, -1, -1):
digit_sum = int(num1[i]) + int(... |
ClassEval_10 | class BinaryDataProcessor:
"""
This is a class used to process binary data, which includes functions such as clearing non 0 or 1 characters, counting binary string information, and converting to corresponding strings based on different encoding methods.
"""
def __init__(self, binary_string):
""... | import unittest
class BinaryDataProcessorTestCleanNonBinaryChars(unittest.TestCase):
def test_clean_non_binary_chars(self):
bdp = BinaryDataProcessor("01101000daf3e4r01100101011011000110110001101111")
self.assertEqual(bdp.binary_string, "0110100001100101011011000110110001101111")
def test_clea... | class BinaryDataProcessor:
def __init__(self, binary_string):
self.binary_string = binary_string
self.clean_non_binary_chars()
def clean_non_binary_chars(self):
self.binary_string = ''.join(filter(lambda x: x in '01', self.binary_string))
def calculate_binary_info(self):
ze... | [] | """
This is a class used to process binary data, which includes functions such as clearing non 0 or 1 characters, counting binary string information, and converting to corresponding strings based on different encoding methods.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [
"self.binary_string"
],
"lib_dependencies": [],
"method_dependencies": []
},
"method_description": "def clean_non_binary_chars(self):\n \"\"\"\n Clean the binary string by removing all no... | BinaryDataProcessor | [
"BinaryDataProcessorTestCleanNonBinaryChars",
"BinaryDataProcessorTestCalculateBinaryInfo",
"BinaryDataProcessorTestConvertToAscii",
"BinaryDataProcessorTestConvertToUtf8",
"BinaryDataProcessorTestMain"
] | class BinaryDataProcessor:
def __init__(self, binary_string):
"""
Initialize the class with a binary string and clean it by removing all non 0 or 1 characters.
"""
self.binary_string = binary_string
self.clean_non_binary_chars()
| [
"self.binary_string"
] | ClassEval_10_m0 | clean_non_binary_chars | def clean_non_binary_chars(self): | class BinaryDataProcessor:
def __init__(self, binary_string):
self.binary_string = binary_string
self.clean_non_binary_chars()
def calculate_binary_info(self):
zeroes_count = self.binary_string.count('0')
ones_count = self.binary_string.count('1')
total_length = len(sel... |
ClassEval_10 | class BinaryDataProcessor:
"""
This is a class used to process binary data, which includes functions such as clearing non 0 or 1 characters, counting binary string information, and converting to corresponding strings based on different encoding methods.
"""
def __init__(self, binary_string):
""... | import unittest
class BinaryDataProcessorTestCleanNonBinaryChars(unittest.TestCase):
def test_clean_non_binary_chars(self):
bdp = BinaryDataProcessor("01101000daf3e4r01100101011011000110110001101111")
self.assertEqual(bdp.binary_string, "0110100001100101011011000110110001101111")
def test_clea... | class BinaryDataProcessor:
def __init__(self, binary_string):
self.binary_string = binary_string
self.clean_non_binary_chars()
def clean_non_binary_chars(self):
self.binary_string = ''.join(filter(lambda x: x in '01', self.binary_string))
def calculate_binary_info(self):
ze... | [] | """
This is a class used to process binary data, which includes functions such as clearing non 0 or 1 characters, counting binary string information, and converting to corresponding strings based on different encoding methods.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [
"self.binary_string"
],
"lib_dependencies": [],
"method_dependencies": []
},
"method_description": "def clean_non_binary_chars(self):\n \"\"\"\n Clean the binary string by removing all no... | BinaryDataProcessor | [
"BinaryDataProcessorTestCleanNonBinaryChars",
"BinaryDataProcessorTestCalculateBinaryInfo",
"BinaryDataProcessorTestConvertToAscii",
"BinaryDataProcessorTestConvertToUtf8",
"BinaryDataProcessorTestMain"
] | class BinaryDataProcessor:
def __init__(self, binary_string):
"""
Initialize the class with a binary string and clean it by removing all non 0 or 1 characters.
"""
self.binary_string = binary_string
self.clean_non_binary_chars()
| [
"self.binary_string"
] | ClassEval_10_m1 | calculate_binary_info | def calculate_binary_info(self): | class BinaryDataProcessor:
def __init__(self, binary_string):
self.binary_string = binary_string
self.clean_non_binary_chars()
def clean_non_binary_chars(self):
self.binary_string = ''.join(filter(lambda x: x in '01', self.binary_string))
def convert_to_ascii(self):
byte_a... |
ClassEval_10 | class BinaryDataProcessor:
"""
This is a class used to process binary data, which includes functions such as clearing non 0 or 1 characters, counting binary string information, and converting to corresponding strings based on different encoding methods.
"""
def __init__(self, binary_string):
""... | import unittest
class BinaryDataProcessorTestCleanNonBinaryChars(unittest.TestCase):
def test_clean_non_binary_chars(self):
bdp = BinaryDataProcessor("01101000daf3e4r01100101011011000110110001101111")
self.assertEqual(bdp.binary_string, "0110100001100101011011000110110001101111")
def test_clea... | class BinaryDataProcessor:
def __init__(self, binary_string):
self.binary_string = binary_string
self.clean_non_binary_chars()
def clean_non_binary_chars(self):
self.binary_string = ''.join(filter(lambda x: x in '01', self.binary_string))
def calculate_binary_info(self):
ze... | [] | """
This is a class used to process binary data, which includes functions such as clearing non 0 or 1 characters, counting binary string information, and converting to corresponding strings based on different encoding methods.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [
"self.binary_string"
],
"lib_dependencies": [],
"method_dependencies": []
},
"method_description": "def clean_non_binary_chars(self):\n \"\"\"\n Clean the binary string by removing all no... | BinaryDataProcessor | [
"BinaryDataProcessorTestCleanNonBinaryChars",
"BinaryDataProcessorTestCalculateBinaryInfo",
"BinaryDataProcessorTestConvertToAscii",
"BinaryDataProcessorTestConvertToUtf8",
"BinaryDataProcessorTestMain"
] | class BinaryDataProcessor:
def __init__(self, binary_string):
"""
Initialize the class with a binary string and clean it by removing all non 0 or 1 characters.
"""
self.binary_string = binary_string
self.clean_non_binary_chars()
| [
"self.binary_string"
] | ClassEval_10_m2 | convert_to_ascii | def convert_to_ascii(self): | class BinaryDataProcessor:
def __init__(self, binary_string):
self.binary_string = binary_string
self.clean_non_binary_chars()
def clean_non_binary_chars(self):
self.binary_string = ''.join(filter(lambda x: x in '01', self.binary_string))
def calculate_binary_info(self):
ze... |
ClassEval_10 | class BinaryDataProcessor:
"""
This is a class used to process binary data, which includes functions such as clearing non 0 or 1 characters, counting binary string information, and converting to corresponding strings based on different encoding methods.
"""
def __init__(self, binary_string):
""... | import unittest
class BinaryDataProcessorTestCleanNonBinaryChars(unittest.TestCase):
def test_clean_non_binary_chars(self):
bdp = BinaryDataProcessor("01101000daf3e4r01100101011011000110110001101111")
self.assertEqual(bdp.binary_string, "0110100001100101011011000110110001101111")
def test_clea... | class BinaryDataProcessor:
def __init__(self, binary_string):
self.binary_string = binary_string
self.clean_non_binary_chars()
def clean_non_binary_chars(self):
self.binary_string = ''.join(filter(lambda x: x in '01', self.binary_string))
def calculate_binary_info(self):
ze... | [] | """
This is a class used to process binary data, which includes functions such as clearing non 0 or 1 characters, counting binary string information, and converting to corresponding strings based on different encoding methods.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [
"self.binary_string"
],
"lib_dependencies": [],
"method_dependencies": []
},
"method_description": "def clean_non_binary_chars(self):\n \"\"\"\n Clean the binary string by removing all no... | BinaryDataProcessor | [
"BinaryDataProcessorTestCleanNonBinaryChars",
"BinaryDataProcessorTestCalculateBinaryInfo",
"BinaryDataProcessorTestConvertToAscii",
"BinaryDataProcessorTestConvertToUtf8",
"BinaryDataProcessorTestMain"
] | class BinaryDataProcessor:
def __init__(self, binary_string):
"""
Initialize the class with a binary string and clean it by removing all non 0 or 1 characters.
"""
self.binary_string = binary_string
self.clean_non_binary_chars()
| [
"self.binary_string"
] | ClassEval_10_m3 | convert_to_utf8 | def convert_to_utf8(self): | class BinaryDataProcessor:
def __init__(self, binary_string):
self.binary_string = binary_string
self.clean_non_binary_chars()
def clean_non_binary_chars(self):
self.binary_string = ''.join(filter(lambda x: x in '01', self.binary_string))
def calculate_binary_info(self):
ze... |
ClassEval_11 | class BitStatusUtil:
"""
This is a utility class that provides methods for manipulating and checking status using bitwise operations.
"""
@staticmethod
def add(states, stat):
"""
Add a status to the current status,and check the parameters wheather they are legal.
:param stat... | import unittest
class BitStatusUtilTestAdd(unittest.TestCase):
def test_add(self):
bit_status_util = BitStatusUtil()
self.assertEqual(bit_status_util.add(2, 4), 6)
def test_add_2(self):
bit_status_util = BitStatusUtil()
self.assertEqual(bit_status_util.add(2, 0), 2)
def t... | class BitStatusUtil:
@staticmethod
def add(states, stat):
BitStatusUtil.check([states, stat])
return states | stat
@staticmethod
def has(states, stat):
BitStatusUtil.check([states, stat])
return (states & stat) == stat
@staticmethod
def remove(states, stat):
... | [] | """
This is a utility class that provides methods for manipulating and checking status using bitwise operations.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [],
"lib_dependencies": [],
"method_dependencies": [
"check"
]
},
"method_description": "def add(states, stat):\n \"\"\"\n Add a status to the current status,and check the parameters wheath... | BitStatusUtil | [
"BitStatusUtilTestAdd",
"BitStatusUtilTestHas",
"BitStatusUtilTestRemove",
"BitStatusUtilTestCheck",
"BitStatusUtilTestMain"
] | class BitStatusUtil:
| [] | ClassEval_11_m0 | add | def add(states, stat): | class BitStatusUtil:
@staticmethod
@staticmethod
def has(states, stat):
BitStatusUtil.check([states, stat])
return (states & stat) == stat
@staticmethod
def remove(states, stat):
BitStatusUtil.check([states, stat])
if BitStatusUtil.has(states, stat):
ret... |
ClassEval_11 | class BitStatusUtil:
"""
This is a utility class that provides methods for manipulating and checking status using bitwise operations.
"""
@staticmethod
def add(states, stat):
"""
Add a status to the current status,and check the parameters wheather they are legal.
:param stat... | import unittest
class BitStatusUtilTestAdd(unittest.TestCase):
def test_add(self):
bit_status_util = BitStatusUtil()
self.assertEqual(bit_status_util.add(2, 4), 6)
def test_add_2(self):
bit_status_util = BitStatusUtil()
self.assertEqual(bit_status_util.add(2, 0), 2)
def t... | class BitStatusUtil:
@staticmethod
def add(states, stat):
BitStatusUtil.check([states, stat])
return states | stat
@staticmethod
def has(states, stat):
BitStatusUtil.check([states, stat])
return (states & stat) == stat
@staticmethod
def remove(states, stat):
... | [] | """
This is a utility class that provides methods for manipulating and checking status using bitwise operations.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [],
"lib_dependencies": [],
"method_dependencies": [
"check"
]
},
"method_description": "def add(states, stat):\n \"\"\"\n Add a status to the current status,and check the parameters wheath... | BitStatusUtil | [
"BitStatusUtilTestAdd",
"BitStatusUtilTestHas",
"BitStatusUtilTestRemove",
"BitStatusUtilTestCheck",
"BitStatusUtilTestMain"
] | class BitStatusUtil:
| [] | ClassEval_11_m1 | has | def has(states, stat): | class BitStatusUtil:
@staticmethod
def add(states, stat):
BitStatusUtil.check([states, stat])
return states | stat
@staticmethod
@staticmethod
def remove(states, stat):
BitStatusUtil.check([states, stat])
if BitStatusUtil.has(states, stat):
return states... |
ClassEval_11 | class BitStatusUtil:
"""
This is a utility class that provides methods for manipulating and checking status using bitwise operations.
"""
@staticmethod
def add(states, stat):
"""
Add a status to the current status,and check the parameters wheather they are legal.
:param stat... | import unittest
class BitStatusUtilTestAdd(unittest.TestCase):
def test_add(self):
bit_status_util = BitStatusUtil()
self.assertEqual(bit_status_util.add(2, 4), 6)
def test_add_2(self):
bit_status_util = BitStatusUtil()
self.assertEqual(bit_status_util.add(2, 0), 2)
def t... | class BitStatusUtil:
@staticmethod
def add(states, stat):
BitStatusUtil.check([states, stat])
return states | stat
@staticmethod
def has(states, stat):
BitStatusUtil.check([states, stat])
return (states & stat) == stat
@staticmethod
def remove(states, stat):
... | [] | """
This is a utility class that provides methods for manipulating and checking status using bitwise operations.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [],
"lib_dependencies": [],
"method_dependencies": [
"check"
]
},
"method_description": "def add(states, stat):\n \"\"\"\n Add a status to the current status,and check the parameters wheath... | BitStatusUtil | [
"BitStatusUtilTestAdd",
"BitStatusUtilTestHas",
"BitStatusUtilTestRemove",
"BitStatusUtilTestCheck",
"BitStatusUtilTestMain"
] | class BitStatusUtil:
| [] | ClassEval_11_m2 | remove | def remove(states, stat): | class BitStatusUtil:
@staticmethod
def add(states, stat):
BitStatusUtil.check([states, stat])
return states | stat
@staticmethod
def has(states, stat):
BitStatusUtil.check([states, stat])
return (states & stat) == stat
@staticmethod
@staticmethod
def check(... |
ClassEval_11 | class BitStatusUtil:
"""
This is a utility class that provides methods for manipulating and checking status using bitwise operations.
"""
@staticmethod
def add(states, stat):
"""
Add a status to the current status,and check the parameters wheather they are legal.
:param stat... | import unittest
class BitStatusUtilTestAdd(unittest.TestCase):
def test_add(self):
bit_status_util = BitStatusUtil()
self.assertEqual(bit_status_util.add(2, 4), 6)
def test_add_2(self):
bit_status_util = BitStatusUtil()
self.assertEqual(bit_status_util.add(2, 0), 2)
def t... | class BitStatusUtil:
@staticmethod
def add(states, stat):
BitStatusUtil.check([states, stat])
return states | stat
@staticmethod
def has(states, stat):
BitStatusUtil.check([states, stat])
return (states & stat) == stat
@staticmethod
def remove(states, stat):
... | [] | """
This is a utility class that provides methods for manipulating and checking status using bitwise operations.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [],
"lib_dependencies": [],
"method_dependencies": [
"check"
]
},
"method_description": "def add(states, stat):\n \"\"\"\n Add a status to the current status,and check the parameters wheath... | BitStatusUtil | [
"BitStatusUtilTestAdd",
"BitStatusUtilTestHas",
"BitStatusUtilTestRemove",
"BitStatusUtilTestCheck",
"BitStatusUtilTestMain"
] | class BitStatusUtil:
| [] | ClassEval_11_m3 | check | def check(args): | class BitStatusUtil:
@staticmethod
def add(states, stat):
BitStatusUtil.check([states, stat])
return states | stat
@staticmethod
def has(states, stat):
BitStatusUtil.check([states, stat])
return (states & stat) == stat
@staticmethod
def remove(states, stat):
... |
ClassEval_12 | import random
class BlackjackGame:
"""
This is a class representing a game of blackjack, which includes creating a deck, calculating the value of a hand, and determine the winner based on the hand values of the player and dealer.
"""
def __init__(self):
"""
Initialize the Blackjack Game... | import unittest
class BlackjackGameTestCreateDeck(unittest.TestCase):
def setUp(self):
self.blackjackGame = BlackjackGame()
self.deck = self.blackjackGame.deck
def test_create_deck_1(self):
self.assertEqual(len(self.deck), 52)
def test_create_deck_2(self):
suits = ['S', 'C... | import random
class BlackjackGame:
def __init__(self):
self.deck = self.create_deck()
self.player_hand = []
self.dealer_hand = []
def create_deck(self):
deck = []
suits = ['S', 'C', 'D', 'H']
ranks = ['A', '2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q',... | [
"import random"
] | """
This is a class representing a game of blackjack, which includes creating a deck, calculating the value of a hand, and determine the winner based on the hand values of the player and dealer.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [],
"lib_dependencies": [
"random"
],
"method_dependencies": []
},
"method_description": "def create_deck(self):\n \"\"\"\n Create a deck of 52 cards, which stores 52 rondom order poker wit... | BlackjackGame | [
"BlackjackGameTestCreateDeck",
"BlackjackGameTestCalculateHandValue",
"BlackjackGameTestCheckWinner",
"BlackjackGameTestMain"
] | class BlackjackGame:
def __init__(self):
"""
Initialize the Blackjack Game with the attribute deck, player_hand and dealer_hand.
While initializing deck attribute, call the create_deck method to generate.
The deck stores 52 rondom order poker with the Jokers removed, format is ['AS'... | [
"self.dealer_hand",
"self.deck",
"self.player_hand"
] | ClassEval_12_m0 | create_deck | def create_deck(self): | import random
class BlackjackGame:
def __init__(self):
self.deck = self.create_deck()
self.player_hand = []
self.dealer_hand = []
def calculate_hand_value(self, hand):
value = 0
num_aces = 0
for card in hand:
rank = card[:-1]
if rank.is... |
ClassEval_12 | import random
class BlackjackGame:
"""
This is a class representing a game of blackjack, which includes creating a deck, calculating the value of a hand, and determine the winner based on the hand values of the player and dealer.
"""
def __init__(self):
"""
Initialize the Blackjack Game... | import unittest
class BlackjackGameTestCreateDeck(unittest.TestCase):
def setUp(self):
self.blackjackGame = BlackjackGame()
self.deck = self.blackjackGame.deck
def test_create_deck_1(self):
self.assertEqual(len(self.deck), 52)
def test_create_deck_2(self):
suits = ['S', 'C... | import random
class BlackjackGame:
def __init__(self):
self.deck = self.create_deck()
self.player_hand = []
self.dealer_hand = []
def create_deck(self):
deck = []
suits = ['S', 'C', 'D', 'H']
ranks = ['A', '2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q',... | [
"import random"
] | """
This is a class representing a game of blackjack, which includes creating a deck, calculating the value of a hand, and determine the winner based on the hand values of the player and dealer.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [],
"lib_dependencies": [
"random"
],
"method_dependencies": []
},
"method_description": "def create_deck(self):\n \"\"\"\n Create a deck of 52 cards, which stores 52 rondom order poker wit... | BlackjackGame | [
"BlackjackGameTestCreateDeck",
"BlackjackGameTestCalculateHandValue",
"BlackjackGameTestCheckWinner",
"BlackjackGameTestMain"
] | class BlackjackGame:
def __init__(self):
"""
Initialize the Blackjack Game with the attribute deck, player_hand and dealer_hand.
While initializing deck attribute, call the create_deck method to generate.
The deck stores 52 rondom order poker with the Jokers removed, format is ['AS'... | [
"self.dealer_hand",
"self.deck",
"self.player_hand"
] | ClassEval_12_m1 | calculate_hand_value | def calculate_hand_value(self, hand): | import random
class BlackjackGame:
def __init__(self):
self.deck = self.create_deck()
self.player_hand = []
self.dealer_hand = []
def create_deck(self):
deck = []
suits = ['S', 'C', 'D', 'H']
ranks = ['A', '2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q',... |
ClassEval_12 | import random
class BlackjackGame:
"""
This is a class representing a game of blackjack, which includes creating a deck, calculating the value of a hand, and determine the winner based on the hand values of the player and dealer.
"""
def __init__(self):
"""
Initialize the Blackjack Game... | import unittest
class BlackjackGameTestCreateDeck(unittest.TestCase):
def setUp(self):
self.blackjackGame = BlackjackGame()
self.deck = self.blackjackGame.deck
def test_create_deck_1(self):
self.assertEqual(len(self.deck), 52)
def test_create_deck_2(self):
suits = ['S', 'C... | import random
class BlackjackGame:
def __init__(self):
self.deck = self.create_deck()
self.player_hand = []
self.dealer_hand = []
def create_deck(self):
deck = []
suits = ['S', 'C', 'D', 'H']
ranks = ['A', '2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q',... | [
"import random"
] | """
This is a class representing a game of blackjack, which includes creating a deck, calculating the value of a hand, and determine the winner based on the hand values of the player and dealer.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [],
"lib_dependencies": [
"random"
],
"method_dependencies": []
},
"method_description": "def create_deck(self):\n \"\"\"\n Create a deck of 52 cards, which stores 52 rondom order poker wit... | BlackjackGame | [
"BlackjackGameTestCreateDeck",
"BlackjackGameTestCalculateHandValue",
"BlackjackGameTestCheckWinner",
"BlackjackGameTestMain"
] | class BlackjackGame:
def __init__(self):
"""
Initialize the Blackjack Game with the attribute deck, player_hand and dealer_hand.
While initializing deck attribute, call the create_deck method to generate.
The deck stores 52 rondom order poker with the Jokers removed, format is ['AS'... | [
"self.dealer_hand",
"self.deck",
"self.player_hand"
] | ClassEval_12_m2 | check_winner | def check_winner(self, player_hand, dealer_hand): | import random
class BlackjackGame:
def __init__(self):
self.deck = self.create_deck()
self.player_hand = []
self.dealer_hand = []
def create_deck(self):
deck = []
suits = ['S', 'C', 'D', 'H']
ranks = ['A', '2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q',... |
ClassEval_13 | class BookManagement:
"""
This is a class as managing books system, which supports to add and remove books from the inventory dict, view the inventory, and check the quantity of a specific book.
"""
def __init__(self):
"""
Initialize the inventory of Book Manager.
"""
se... | import unittest
class BookManagementTestAddBook(unittest.TestCase):
def test_add_book_1(self):
bookManagement = BookManagement()
bookManagement.add_book("book1")
self.assertEqual({"book1": 1}, bookManagement.inventory)
def test_add_book_2(self):
bookManagement = BookManagement... | class BookManagement:
def __init__(self):
self.inventory = {}
def add_book(self, title, quantity=1):
if title in self.inventory:
self.inventory[title] += quantity
else:
self.inventory[title] = quantity
def remove_book(self, title, quantity):
if title... | [] | """
This is a class as managing books system, which supports to add and remove books from the inventory dict, view the inventory, and check the quantity of a specific book.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [
"self.inventory"
],
"lib_dependencies": [],
"method_dependencies": []
},
"method_description": "def add_book(self, title, quantity=1):\n \"\"\"\n Add one or several books to inventory whi... | BookManagement | [
"BookManagementTestAddBook",
"BookManagementTestRemoveBook",
"BookManagementTestViewInventory",
"BookManagementTestViewBookQuantity",
"BookManagementTestMain"
] | class BookManagement:
def __init__(self):
"""
Initialize the inventory of Book Manager.
"""
self.inventory = {}
| [
"self.inventory"
] | ClassEval_13_m0 | add_book | def add_book(self, title, quantity=1): | class BookManagement:
def __init__(self):
self.inventory = {}
def remove_book(self, title, quantity):
if title not in self.inventory or self.inventory[title] < quantity:
raise False
self.inventory[title] -= quantity
if self.inventory[title] == 0:
del (se... |
ClassEval_13 | class BookManagement:
"""
This is a class as managing books system, which supports to add and remove books from the inventory dict, view the inventory, and check the quantity of a specific book.
"""
def __init__(self):
"""
Initialize the inventory of Book Manager.
"""
se... | import unittest
class BookManagementTestAddBook(unittest.TestCase):
def test_add_book_1(self):
bookManagement = BookManagement()
bookManagement.add_book("book1")
self.assertEqual({"book1": 1}, bookManagement.inventory)
def test_add_book_2(self):
bookManagement = BookManagement... | class BookManagement:
def __init__(self):
self.inventory = {}
def add_book(self, title, quantity=1):
if title in self.inventory:
self.inventory[title] += quantity
else:
self.inventory[title] = quantity
def remove_book(self, title, quantity):
if title... | [] | """
This is a class as managing books system, which supports to add and remove books from the inventory dict, view the inventory, and check the quantity of a specific book.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [
"self.inventory"
],
"lib_dependencies": [],
"method_dependencies": []
},
"method_description": "def add_book(self, title, quantity=1):\n \"\"\"\n Add one or several books to inventory whi... | BookManagement | [
"BookManagementTestAddBook",
"BookManagementTestRemoveBook",
"BookManagementTestViewInventory",
"BookManagementTestViewBookQuantity",
"BookManagementTestMain"
] | class BookManagement:
def __init__(self):
"""
Initialize the inventory of Book Manager.
"""
self.inventory = {}
| [
"self.inventory"
] | ClassEval_13_m1 | remove_book | def remove_book(self, title, quantity): | class BookManagement:
def __init__(self):
self.inventory = {}
def add_book(self, title, quantity=1):
if title in self.inventory:
self.inventory[title] += quantity
else:
self.inventory[title] = quantity
def view_inventory(self):
return self.inventory... |
ClassEval_13 | class BookManagement:
"""
This is a class as managing books system, which supports to add and remove books from the inventory dict, view the inventory, and check the quantity of a specific book.
"""
def __init__(self):
"""
Initialize the inventory of Book Manager.
"""
se... | import unittest
class BookManagementTestAddBook(unittest.TestCase):
def test_add_book_1(self):
bookManagement = BookManagement()
bookManagement.add_book("book1")
self.assertEqual({"book1": 1}, bookManagement.inventory)
def test_add_book_2(self):
bookManagement = BookManagement... | class BookManagement:
def __init__(self):
self.inventory = {}
def add_book(self, title, quantity=1):
if title in self.inventory:
self.inventory[title] += quantity
else:
self.inventory[title] = quantity
def remove_book(self, title, quantity):
if title... | [] | """
This is a class as managing books system, which supports to add and remove books from the inventory dict, view the inventory, and check the quantity of a specific book.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [
"self.inventory"
],
"lib_dependencies": [],
"method_dependencies": []
},
"method_description": "def add_book(self, title, quantity=1):\n \"\"\"\n Add one or several books to inventory whi... | BookManagement | [
"BookManagementTestAddBook",
"BookManagementTestRemoveBook",
"BookManagementTestViewInventory",
"BookManagementTestViewBookQuantity",
"BookManagementTestMain"
] | class BookManagement:
def __init__(self):
"""
Initialize the inventory of Book Manager.
"""
self.inventory = {}
| [
"self.inventory"
] | ClassEval_13_m2 | view_inventory | def view_inventory(self): | class BookManagement:
def __init__(self):
self.inventory = {}
def add_book(self, title, quantity=1):
if title in self.inventory:
self.inventory[title] += quantity
else:
self.inventory[title] = quantity
def remove_book(self, title, quantity):
if title... |
ClassEval_13 | class BookManagement:
"""
This is a class as managing books system, which supports to add and remove books from the inventory dict, view the inventory, and check the quantity of a specific book.
"""
def __init__(self):
"""
Initialize the inventory of Book Manager.
"""
se... | import unittest
class BookManagementTestAddBook(unittest.TestCase):
def test_add_book_1(self):
bookManagement = BookManagement()
bookManagement.add_book("book1")
self.assertEqual({"book1": 1}, bookManagement.inventory)
def test_add_book_2(self):
bookManagement = BookManagement... | class BookManagement:
def __init__(self):
self.inventory = {}
def add_book(self, title, quantity=1):
if title in self.inventory:
self.inventory[title] += quantity
else:
self.inventory[title] = quantity
def remove_book(self, title, quantity):
if title... | [] | """
This is a class as managing books system, which supports to add and remove books from the inventory dict, view the inventory, and check the quantity of a specific book.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [
"self.inventory"
],
"lib_dependencies": [],
"method_dependencies": []
},
"method_description": "def add_book(self, title, quantity=1):\n \"\"\"\n Add one or several books to inventory whi... | BookManagement | [
"BookManagementTestAddBook",
"BookManagementTestRemoveBook",
"BookManagementTestViewInventory",
"BookManagementTestViewBookQuantity",
"BookManagementTestMain"
] | class BookManagement:
def __init__(self):
"""
Initialize the inventory of Book Manager.
"""
self.inventory = {}
| [
"self.inventory"
] | ClassEval_13_m3 | view_book_quantity | def view_book_quantity(self, title): | class BookManagement:
def __init__(self):
self.inventory = {}
def add_book(self, title, quantity=1):
if title in self.inventory:
self.inventory[title] += quantity
else:
self.inventory[title] = quantity
def remove_book(self, title, quantity):
if title... |
ClassEval_14 | import sqlite3
class BookManagementDB:
"""
This is a database class as a book management system, used to handle the operations of adding, removing, updating, and searching books.
"""
def __init__(self, db_name):
"""
Initializes the class by creating a database connection and cursor,
... | import unittest
import os
class BookManagementDBTestCreateTable(unittest.TestCase):
def setUp(self):
self.db_name = "test.db"
self.db = BookManagementDB(self.db_name)
self.connection = sqlite3.connect(self.db_name)
self.cursor = self.connection.cursor()
def test_create_table_1... | import sqlite3
class BookManagementDB:
def __init__(self, db_name):
self.connection = sqlite3.connect(db_name)
self.cursor = self.connection.cursor()
self.create_table()
def create_table(self):
self.cursor.execute('''
CREATE TABLE IF NOT EXISTS books (
... | [
"import sqlite3"
] | """
This is a database class as a book management system, used to handle the operations of adding, removing, updating, and searching books.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [
"self.connection",
"self.cursor"
],
"lib_dependencies": [],
"method_dependencies": []
},
"method_description": "def create_table(self):\n \"\"\"\n Creates the book table in the da... | BookManagementDB | [
"BookManagementDBTestCreateTable",
"BookManagementDBTestAddBook",
"BookManagementDBTestRemoveBook",
"BookManagementDBTestBorrowBook",
"BookManagementDBTestReturnBook",
"BookManagementDBTestSearchBooks"
] | class BookManagementDB:
def __init__(self, db_name):
"""
Initializes the class by creating a database connection and cursor,
and creates the book table if it does not already exist
:param db_name: str, the name of db file
"""
self.connection = sqlite3.connect(db_nam... | [
"self.connection",
"self.cursor"
] | ClassEval_14_m0 | create_table | def create_table(self): | import sqlite3
class BookManagementDB:
def __init__(self, db_name):
self.connection = sqlite3.connect(db_name)
self.cursor = self.connection.cursor()
self.create_table()
def add_book(self, title, author):
self.cursor.execute('''
INSERT INTO books (title, author, av... |
ClassEval_14 | import sqlite3
class BookManagementDB:
"""
This is a database class as a book management system, used to handle the operations of adding, removing, updating, and searching books.
"""
def __init__(self, db_name):
"""
Initializes the class by creating a database connection and cursor,
... | import unittest
import os
class BookManagementDBTestCreateTable(unittest.TestCase):
def setUp(self):
self.db_name = "test.db"
self.db = BookManagementDB(self.db_name)
self.connection = sqlite3.connect(self.db_name)
self.cursor = self.connection.cursor()
def test_create_table_1... | import sqlite3
class BookManagementDB:
def __init__(self, db_name):
self.connection = sqlite3.connect(db_name)
self.cursor = self.connection.cursor()
self.create_table()
def create_table(self):
self.cursor.execute('''
CREATE TABLE IF NOT EXISTS books (
... | [
"import sqlite3"
] | """
This is a database class as a book management system, used to handle the operations of adding, removing, updating, and searching books.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [
"self.connection",
"self.cursor"
],
"lib_dependencies": [],
"method_dependencies": []
},
"method_description": "def create_table(self):\n \"\"\"\n Creates the book table in the da... | BookManagementDB | [
"BookManagementDBTestCreateTable",
"BookManagementDBTestAddBook",
"BookManagementDBTestRemoveBook",
"BookManagementDBTestBorrowBook",
"BookManagementDBTestReturnBook",
"BookManagementDBTestSearchBooks"
] | class BookManagementDB:
def __init__(self, db_name):
"""
Initializes the class by creating a database connection and cursor,
and creates the book table if it does not already exist
:param db_name: str, the name of db file
"""
self.connection = sqlite3.connect(db_nam... | [
"self.connection",
"self.cursor"
] | ClassEval_14_m1 | add_book | def add_book(self, title, author): | import sqlite3
class BookManagementDB:
def __init__(self, db_name):
self.connection = sqlite3.connect(db_name)
self.cursor = self.connection.cursor()
self.create_table()
def create_table(self):
self.cursor.execute('''
CREATE TABLE IF NOT EXISTS books (
... |
ClassEval_14 | import sqlite3
class BookManagementDB:
"""
This is a database class as a book management system, used to handle the operations of adding, removing, updating, and searching books.
"""
def __init__(self, db_name):
"""
Initializes the class by creating a database connection and cursor,
... | import unittest
import os
class BookManagementDBTestCreateTable(unittest.TestCase):
def setUp(self):
self.db_name = "test.db"
self.db = BookManagementDB(self.db_name)
self.connection = sqlite3.connect(self.db_name)
self.cursor = self.connection.cursor()
def test_create_table_1... | import sqlite3
class BookManagementDB:
def __init__(self, db_name):
self.connection = sqlite3.connect(db_name)
self.cursor = self.connection.cursor()
self.create_table()
def create_table(self):
self.cursor.execute('''
CREATE TABLE IF NOT EXISTS books (
... | [
"import sqlite3"
] | """
This is a database class as a book management system, used to handle the operations of adding, removing, updating, and searching books.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [
"self.connection",
"self.cursor"
],
"lib_dependencies": [],
"method_dependencies": []
},
"method_description": "def create_table(self):\n \"\"\"\n Creates the book table in the da... | BookManagementDB | [
"BookManagementDBTestCreateTable",
"BookManagementDBTestAddBook",
"BookManagementDBTestRemoveBook",
"BookManagementDBTestBorrowBook",
"BookManagementDBTestReturnBook",
"BookManagementDBTestSearchBooks"
] | class BookManagementDB:
def __init__(self, db_name):
"""
Initializes the class by creating a database connection and cursor,
and creates the book table if it does not already exist
:param db_name: str, the name of db file
"""
self.connection = sqlite3.connect(db_nam... | [
"self.connection",
"self.cursor"
] | ClassEval_14_m2 | remove_book | def remove_book(self, book_id): | import sqlite3
class BookManagementDB:
def __init__(self, db_name):
self.connection = sqlite3.connect(db_name)
self.cursor = self.connection.cursor()
self.create_table()
def create_table(self):
self.cursor.execute('''
CREATE TABLE IF NOT EXISTS books (
... |
ClassEval_14 | import sqlite3
class BookManagementDB:
"""
This is a database class as a book management system, used to handle the operations of adding, removing, updating, and searching books.
"""
def __init__(self, db_name):
"""
Initializes the class by creating a database connection and cursor,
... | import unittest
import os
class BookManagementDBTestCreateTable(unittest.TestCase):
def setUp(self):
self.db_name = "test.db"
self.db = BookManagementDB(self.db_name)
self.connection = sqlite3.connect(self.db_name)
self.cursor = self.connection.cursor()
def test_create_table_1... | import sqlite3
class BookManagementDB:
def __init__(self, db_name):
self.connection = sqlite3.connect(db_name)
self.cursor = self.connection.cursor()
self.create_table()
def create_table(self):
self.cursor.execute('''
CREATE TABLE IF NOT EXISTS books (
... | [
"import sqlite3"
] | """
This is a database class as a book management system, used to handle the operations of adding, removing, updating, and searching books.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [
"self.connection",
"self.cursor"
],
"lib_dependencies": [],
"method_dependencies": []
},
"method_description": "def create_table(self):\n \"\"\"\n Creates the book table in the da... | BookManagementDB | [
"BookManagementDBTestCreateTable",
"BookManagementDBTestAddBook",
"BookManagementDBTestRemoveBook",
"BookManagementDBTestBorrowBook",
"BookManagementDBTestReturnBook",
"BookManagementDBTestSearchBooks"
] | class BookManagementDB:
def __init__(self, db_name):
"""
Initializes the class by creating a database connection and cursor,
and creates the book table if it does not already exist
:param db_name: str, the name of db file
"""
self.connection = sqlite3.connect(db_nam... | [
"self.connection",
"self.cursor"
] | ClassEval_14_m3 | borrow_book | def borrow_book(self, book_id): | import sqlite3
class BookManagementDB:
def __init__(self, db_name):
self.connection = sqlite3.connect(db_name)
self.cursor = self.connection.cursor()
self.create_table()
def create_table(self):
self.cursor.execute('''
CREATE TABLE IF NOT EXISTS books (
... |
ClassEval_14 | import sqlite3
class BookManagementDB:
"""
This is a database class as a book management system, used to handle the operations of adding, removing, updating, and searching books.
"""
def __init__(self, db_name):
"""
Initializes the class by creating a database connection and cursor,
... | import unittest
import os
class BookManagementDBTestCreateTable(unittest.TestCase):
def setUp(self):
self.db_name = "test.db"
self.db = BookManagementDB(self.db_name)
self.connection = sqlite3.connect(self.db_name)
self.cursor = self.connection.cursor()
def test_create_table_1... | import sqlite3
class BookManagementDB:
def __init__(self, db_name):
self.connection = sqlite3.connect(db_name)
self.cursor = self.connection.cursor()
self.create_table()
def create_table(self):
self.cursor.execute('''
CREATE TABLE IF NOT EXISTS books (
... | [
"import sqlite3"
] | """
This is a database class as a book management system, used to handle the operations of adding, removing, updating, and searching books.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [
"self.connection",
"self.cursor"
],
"lib_dependencies": [],
"method_dependencies": []
},
"method_description": "def create_table(self):\n \"\"\"\n Creates the book table in the da... | BookManagementDB | [
"BookManagementDBTestCreateTable",
"BookManagementDBTestAddBook",
"BookManagementDBTestRemoveBook",
"BookManagementDBTestBorrowBook",
"BookManagementDBTestReturnBook",
"BookManagementDBTestSearchBooks"
] | class BookManagementDB:
def __init__(self, db_name):
"""
Initializes the class by creating a database connection and cursor,
and creates the book table if it does not already exist
:param db_name: str, the name of db file
"""
self.connection = sqlite3.connect(db_nam... | [
"self.connection",
"self.cursor"
] | ClassEval_14_m4 | return_book | def return_book(self, book_id): | import sqlite3
class BookManagementDB:
def __init__(self, db_name):
self.connection = sqlite3.connect(db_name)
self.cursor = self.connection.cursor()
self.create_table()
def create_table(self):
self.cursor.execute('''
CREATE TABLE IF NOT EXISTS books (
... |
ClassEval_14 | import sqlite3
class BookManagementDB:
"""
This is a database class as a book management system, used to handle the operations of adding, removing, updating, and searching books.
"""
def __init__(self, db_name):
"""
Initializes the class by creating a database connection and cursor,
... | import unittest
import os
class BookManagementDBTestCreateTable(unittest.TestCase):
def setUp(self):
self.db_name = "test.db"
self.db = BookManagementDB(self.db_name)
self.connection = sqlite3.connect(self.db_name)
self.cursor = self.connection.cursor()
def test_create_table_1... | import sqlite3
class BookManagementDB:
def __init__(self, db_name):
self.connection = sqlite3.connect(db_name)
self.cursor = self.connection.cursor()
self.create_table()
def create_table(self):
self.cursor.execute('''
CREATE TABLE IF NOT EXISTS books (
... | [
"import sqlite3"
] | """
This is a database class as a book management system, used to handle the operations of adding, removing, updating, and searching books.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [
"self.connection",
"self.cursor"
],
"lib_dependencies": [],
"method_dependencies": []
},
"method_description": "def create_table(self):\n \"\"\"\n Creates the book table in the da... | BookManagementDB | [
"BookManagementDBTestCreateTable",
"BookManagementDBTestAddBook",
"BookManagementDBTestRemoveBook",
"BookManagementDBTestBorrowBook",
"BookManagementDBTestReturnBook",
"BookManagementDBTestSearchBooks"
] | class BookManagementDB:
def __init__(self, db_name):
"""
Initializes the class by creating a database connection and cursor,
and creates the book table if it does not already exist
:param db_name: str, the name of db file
"""
self.connection = sqlite3.connect(db_nam... | [
"self.connection",
"self.cursor"
] | ClassEval_14_m5 | search_books | def search_books(self): | import sqlite3
class BookManagementDB:
def __init__(self, db_name):
self.connection = sqlite3.connect(db_name)
self.cursor = self.connection.cursor()
self.create_table()
def create_table(self):
self.cursor.execute('''
CREATE TABLE IF NOT EXISTS books (
... |
ClassEval_15 | class BoyerMooreSearch:
"""
his is a class that implements the Boyer-Moore algorithm for string searching, which is used to find occurrences of a pattern within a given text.
"""
def __init__(self, text, pattern):
"""
Initializes the BoyerMooreSearch class with the given text and patter... | import unittest
class BoyerMooreSearchTestMatchInPattern(unittest.TestCase):
def test_match_in_pattern(self):
boyerMooreSearch = BoyerMooreSearch("ABAABA", "AB")
self.assertEqual(boyerMooreSearch.match_in_pattern("A"), 0)
def test_match_in_pattern_2(self):
boyerMooreSearch = BoyerMoore... | class BoyerMooreSearch:
def __init__(self, text, pattern):
self.text, self.pattern = text, pattern
self.textLen, self.patLen = len(text), len(pattern)
def match_in_pattern(self, char):
for i in range(self.patLen - 1, -1, -1):
if char == self.pattern[i]:
retur... | [] | """
his is a class that implements the Boyer-Moore algorithm for string searching, which is used to find occurrences of a pattern within a given text.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [
"self.patLen",
"self.pattern"
],
"lib_dependencies": [],
"method_dependencies": []
},
"method_description": "def match_in_pattern(self, char):\n \"\"\"\n Finds the rightmost occur... | BoyerMooreSearch | [
"BoyerMooreSearchTestMatchInPattern",
"BoyerMooreSearchTestMismatchInText",
"BoyerMooreSearchTestBadCharacterHeuristic",
"BoyerMooreSearchTestMain"
] | class BoyerMooreSearch:
def __init__(self, text, pattern):
"""
Initializes the BoyerMooreSearch class with the given text and pattern.
:param text: The text to be searched, str.
:param pattern: The pattern to be searched for, str.
"""
self.text, self.pattern = text, ... | [
"self.patLen",
"self.pattern",
"self.text",
"self.textLen"
] | ClassEval_15_m0 | match_in_pattern | def match_in_pattern(self, char): | class BoyerMooreSearch:
def __init__(self, text, pattern):
self.text, self.pattern = text, pattern
self.textLen, self.patLen = len(text), len(pattern)
def mismatch_in_text(self, currentPos):
for i in range(self.patLen - 1, -1, -1):
if self.pattern[i] != self.text[currentPos... |
ClassEval_15 | class BoyerMooreSearch:
"""
his is a class that implements the Boyer-Moore algorithm for string searching, which is used to find occurrences of a pattern within a given text.
"""
def __init__(self, text, pattern):
"""
Initializes the BoyerMooreSearch class with the given text and patter... | import unittest
class BoyerMooreSearchTestMatchInPattern(unittest.TestCase):
def test_match_in_pattern(self):
boyerMooreSearch = BoyerMooreSearch("ABAABA", "AB")
self.assertEqual(boyerMooreSearch.match_in_pattern("A"), 0)
def test_match_in_pattern_2(self):
boyerMooreSearch = BoyerMoore... | class BoyerMooreSearch:
def __init__(self, text, pattern):
self.text, self.pattern = text, pattern
self.textLen, self.patLen = len(text), len(pattern)
def match_in_pattern(self, char):
for i in range(self.patLen - 1, -1, -1):
if char == self.pattern[i]:
retur... | [] | """
his is a class that implements the Boyer-Moore algorithm for string searching, which is used to find occurrences of a pattern within a given text.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [
"self.patLen",
"self.pattern"
],
"lib_dependencies": [],
"method_dependencies": []
},
"method_description": "def match_in_pattern(self, char):\n \"\"\"\n Finds the rightmost occur... | BoyerMooreSearch | [
"BoyerMooreSearchTestMatchInPattern",
"BoyerMooreSearchTestMismatchInText",
"BoyerMooreSearchTestBadCharacterHeuristic",
"BoyerMooreSearchTestMain"
] | class BoyerMooreSearch:
def __init__(self, text, pattern):
"""
Initializes the BoyerMooreSearch class with the given text and pattern.
:param text: The text to be searched, str.
:param pattern: The pattern to be searched for, str.
"""
self.text, self.pattern = text, ... | [
"self.patLen",
"self.pattern",
"self.text",
"self.textLen"
] | ClassEval_15_m1 | mismatch_in_text | def mismatch_in_text(self, currentPos): | class BoyerMooreSearch:
def __init__(self, text, pattern):
self.text, self.pattern = text, pattern
self.textLen, self.patLen = len(text), len(pattern)
def match_in_pattern(self, char):
for i in range(self.patLen - 1, -1, -1):
if char == self.pattern[i]:
retur... |
ClassEval_15 | class BoyerMooreSearch:
"""
his is a class that implements the Boyer-Moore algorithm for string searching, which is used to find occurrences of a pattern within a given text.
"""
def __init__(self, text, pattern):
"""
Initializes the BoyerMooreSearch class with the given text and patter... | import unittest
class BoyerMooreSearchTestMatchInPattern(unittest.TestCase):
def test_match_in_pattern(self):
boyerMooreSearch = BoyerMooreSearch("ABAABA", "AB")
self.assertEqual(boyerMooreSearch.match_in_pattern("A"), 0)
def test_match_in_pattern_2(self):
boyerMooreSearch = BoyerMoore... | class BoyerMooreSearch:
def __init__(self, text, pattern):
self.text, self.pattern = text, pattern
self.textLen, self.patLen = len(text), len(pattern)
def match_in_pattern(self, char):
for i in range(self.patLen - 1, -1, -1):
if char == self.pattern[i]:
retur... | [] | """
his is a class that implements the Boyer-Moore algorithm for string searching, which is used to find occurrences of a pattern within a given text.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [
"self.patLen",
"self.pattern"
],
"lib_dependencies": [],
"method_dependencies": []
},
"method_description": "def match_in_pattern(self, char):\n \"\"\"\n Finds the rightmost occur... | BoyerMooreSearch | [
"BoyerMooreSearchTestMatchInPattern",
"BoyerMooreSearchTestMismatchInText",
"BoyerMooreSearchTestBadCharacterHeuristic",
"BoyerMooreSearchTestMain"
] | class BoyerMooreSearch:
def __init__(self, text, pattern):
"""
Initializes the BoyerMooreSearch class with the given text and pattern.
:param text: The text to be searched, str.
:param pattern: The pattern to be searched for, str.
"""
self.text, self.pattern = text, ... | [
"self.patLen",
"self.pattern",
"self.text",
"self.textLen"
] | ClassEval_15_m2 | bad_character_heuristic | def bad_character_heuristic(self): | class BoyerMooreSearch:
def __init__(self, text, pattern):
self.text, self.pattern = text, pattern
self.textLen, self.patLen = len(text), len(pattern)
def match_in_pattern(self, char):
for i in range(self.patLen - 1, -1, -1):
if char == self.pattern[i]:
retur... |
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_m0 | calculate | def calculate(self, expression): | 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 precedence(self, operator):
precedence... |
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_m1 | precedence | def precedence(self, operator): | 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... |
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_m2 | 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... |
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_m0 | add_event | def add_event(self, event): | from datetime import datetime, timedelta
class CalendarUtil:
def __init__(self):
self.events = []
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:
... |
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_m1 | 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 get_events(self, date):
events_on_date = []
for event in self.events:
if event['date'].date() == date.da... |
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_m2 | 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 is_available(self, 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_m3 | 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):
... |
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_m4 | 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):
... |
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_m5 | 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):
... |
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_m0 | __getitem__ | def __getitem__(self, key): | class CamelCaseMap:
def __init__(self):
self._data = {}
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):... |
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_m1 | __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 __delitem__(self, key):
del self._data[self._convert_key(key)]
def __iter__(self):
return iter(self._data)
def __len__(self):
... |
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_m2 | __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 __iter__(self):
return iter(self._data)
def __len__(sel... |
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_m3 | __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)... |
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_m4 | __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)... |
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_m5 | _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)... |
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_m6 | _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)... |
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_m0 | generate_primes | def generate_primes(self): | class ChandrasekharSieve:
def __init__(self, n):
self.n = n
self.primes = self.generate_primes()
def get_primes(self):
return self.primes
def generate_primes(self):
"""
Generate prime numbers up to the specified limit using the Chandrasekhar sieve algorithm.
... |
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_m1 | 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:
... |
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_m0 | add_user | def add_user(self, username): | from datetime import datetime
class Chat:
def __init__(self):
self.users = {}
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):... |
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_m1 | 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 send_message(self, sender, receiver, message):
... |
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_m2 | 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 ... |
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_m3 | 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 ... |
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_m0 | add_course | def add_course(self, course): | from datetime import datetime
class Classroom:
def __init__(self, id):
self.id = id
self.courses = []
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(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_m1 | 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 is_free_at(self, check_time):
check_time = datetime.strptime(ch... |
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_m2 | 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:
... |
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_m3 | check_course_conflict | def check_course_conflict(self, new_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:
... |
ClassEval_23 | import math
from typing import List
class CombinationCalculator:
"""
This is a class that provides methods to calculate the number of combinations for a specific count, calculate all possible combinations, and generate combinations with a specified number of elements.
"""
def __init__(self, datas: Lis... | import unittest
class CombinationCalculatorTestCount(unittest.TestCase):
def test_count(self):
self.assertEqual(CombinationCalculator.count(4, 2), 6)
def test_count_2(self):
self.assertEqual(CombinationCalculator.count(5, 3), 10)
def test_count_3(self):
self.assertEqual(Combination... | import math
from typing import List
class CombinationCalculator:
def __init__(self, datas: List[str]):
self.datas = datas
@staticmethod
def count(n: int, m: int) -> int:
if m == 0 or n == m:
return 1
return math.factorial(n) // (math.factorial(n - m) * math.factorial(m)... | [
"import math",
"from typing import List"
] | """
This is a class that provides methods to calculate the number of combinations for a specific count, calculate all possible combinations, and generate combinations with a specified number of elements.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [],
"lib_dependencies": [
"math"
],
"method_dependencies": []
},
"method_description": "def count(n: int, m: int) -> int:\n \"\"\"\n Calculate the number of combinations for a specific coun... | CombinationCalculator | [
"CombinationCalculatorTestCount",
"CombinationCalculatorTestCountAll",
"CombinationCalculatorTestSelect",
"CombinationCalculatorTestSelectAll",
"CombinationCalculatorTestSelect2",
"CombinationCalculatorTestMain"
] | class CombinationCalculator:
def __init__(self, datas: List[str]):
"""
Initialize the calculator with a list of data.
"""
self.datas = datas
| [
"self.datas"
] | ClassEval_23_m0 | count | def count(n: int, m: int) -> int: | import math
from typing import List
class CombinationCalculator:
def __init__(self, datas: List[str]):
self.datas = datas
@staticmethod
@staticmethod
def count_all(n: int) -> int:
if n < 0 or n > 63:
return False
return (1 << n) - 1 if n != 63 else float("inf")
... |
ClassEval_23 | import math
from typing import List
class CombinationCalculator:
"""
This is a class that provides methods to calculate the number of combinations for a specific count, calculate all possible combinations, and generate combinations with a specified number of elements.
"""
def __init__(self, datas: Lis... | import unittest
class CombinationCalculatorTestCount(unittest.TestCase):
def test_count(self):
self.assertEqual(CombinationCalculator.count(4, 2), 6)
def test_count_2(self):
self.assertEqual(CombinationCalculator.count(5, 3), 10)
def test_count_3(self):
self.assertEqual(Combination... | import math
from typing import List
class CombinationCalculator:
def __init__(self, datas: List[str]):
self.datas = datas
@staticmethod
def count(n: int, m: int) -> int:
if m == 0 or n == m:
return 1
return math.factorial(n) // (math.factorial(n - m) * math.factorial(m)... | [
"import math",
"from typing import List"
] | """
This is a class that provides methods to calculate the number of combinations for a specific count, calculate all possible combinations, and generate combinations with a specified number of elements.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [],
"lib_dependencies": [
"math"
],
"method_dependencies": []
},
"method_description": "def count(n: int, m: int) -> int:\n \"\"\"\n Calculate the number of combinations for a specific coun... | CombinationCalculator | [
"CombinationCalculatorTestCount",
"CombinationCalculatorTestCountAll",
"CombinationCalculatorTestSelect",
"CombinationCalculatorTestSelectAll",
"CombinationCalculatorTestSelect2",
"CombinationCalculatorTestMain"
] | class CombinationCalculator:
def __init__(self, datas: List[str]):
"""
Initialize the calculator with a list of data.
"""
self.datas = datas
| [
"self.datas"
] | ClassEval_23_m1 | count_all | def count_all(n: int) -> int: | import math
from typing import List
class CombinationCalculator:
def __init__(self, datas: List[str]):
self.datas = datas
@staticmethod
def count(n: int, m: int) -> int:
if m == 0 or n == m:
return 1
return math.factorial(n) // (math.factorial(n - m) * math.factorial(m)... |
ClassEval_23 | import math
from typing import List
class CombinationCalculator:
"""
This is a class that provides methods to calculate the number of combinations for a specific count, calculate all possible combinations, and generate combinations with a specified number of elements.
"""
def __init__(self, datas: Lis... | import unittest
class CombinationCalculatorTestCount(unittest.TestCase):
def test_count(self):
self.assertEqual(CombinationCalculator.count(4, 2), 6)
def test_count_2(self):
self.assertEqual(CombinationCalculator.count(5, 3), 10)
def test_count_3(self):
self.assertEqual(Combination... | import math
from typing import List
class CombinationCalculator:
def __init__(self, datas: List[str]):
self.datas = datas
@staticmethod
def count(n: int, m: int) -> int:
if m == 0 or n == m:
return 1
return math.factorial(n) // (math.factorial(n - m) * math.factorial(m)... | [
"import math",
"from typing import List"
] | """
This is a class that provides methods to calculate the number of combinations for a specific count, calculate all possible combinations, and generate combinations with a specified number of elements.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [],
"lib_dependencies": [
"math"
],
"method_dependencies": []
},
"method_description": "def count(n: int, m: int) -> int:\n \"\"\"\n Calculate the number of combinations for a specific coun... | CombinationCalculator | [
"CombinationCalculatorTestCount",
"CombinationCalculatorTestCountAll",
"CombinationCalculatorTestSelect",
"CombinationCalculatorTestSelectAll",
"CombinationCalculatorTestSelect2",
"CombinationCalculatorTestMain"
] | class CombinationCalculator:
def __init__(self, datas: List[str]):
"""
Initialize the calculator with a list of data.
"""
self.datas = datas
| [
"self.datas"
] | ClassEval_23_m2 | select | def select(self, m: int) -> List[List[str]]: | import math
from typing import List
class CombinationCalculator:
def __init__(self, datas: List[str]):
self.datas = datas
@staticmethod
def count(n: int, m: int) -> int:
if m == 0 or n == m:
return 1
return math.factorial(n) // (math.factorial(n - m) * math.factorial(m)... |
ClassEval_23 | import math
from typing import List
class CombinationCalculator:
"""
This is a class that provides methods to calculate the number of combinations for a specific count, calculate all possible combinations, and generate combinations with a specified number of elements.
"""
def __init__(self, datas: Lis... | import unittest
class CombinationCalculatorTestCount(unittest.TestCase):
def test_count(self):
self.assertEqual(CombinationCalculator.count(4, 2), 6)
def test_count_2(self):
self.assertEqual(CombinationCalculator.count(5, 3), 10)
def test_count_3(self):
self.assertEqual(Combination... | import math
from typing import List
class CombinationCalculator:
def __init__(self, datas: List[str]):
self.datas = datas
@staticmethod
def count(n: int, m: int) -> int:
if m == 0 or n == m:
return 1
return math.factorial(n) // (math.factorial(n - m) * math.factorial(m)... | [
"import math",
"from typing import List"
] | """
This is a class that provides methods to calculate the number of combinations for a specific count, calculate all possible combinations, and generate combinations with a specified number of elements.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [],
"lib_dependencies": [
"math"
],
"method_dependencies": []
},
"method_description": "def count(n: int, m: int) -> int:\n \"\"\"\n Calculate the number of combinations for a specific coun... | CombinationCalculator | [
"CombinationCalculatorTestCount",
"CombinationCalculatorTestCountAll",
"CombinationCalculatorTestSelect",
"CombinationCalculatorTestSelectAll",
"CombinationCalculatorTestSelect2",
"CombinationCalculatorTestMain"
] | class CombinationCalculator:
def __init__(self, datas: List[str]):
"""
Initialize the calculator with a list of data.
"""
self.datas = datas
| [
"self.datas"
] | ClassEval_23_m3 | select_all | def select_all(self) -> List[List[str]]: | import math
from typing import List
class CombinationCalculator:
def __init__(self, datas: List[str]):
self.datas = datas
@staticmethod
def count(n: int, m: int) -> int:
if m == 0 or n == m:
return 1
return math.factorial(n) // (math.factorial(n - m) * math.factorial(m)... |
ClassEval_23 | import math
from typing import List
class CombinationCalculator:
"""
This is a class that provides methods to calculate the number of combinations for a specific count, calculate all possible combinations, and generate combinations with a specified number of elements.
"""
def __init__(self, datas: Lis... | import unittest
class CombinationCalculatorTestCount(unittest.TestCase):
def test_count(self):
self.assertEqual(CombinationCalculator.count(4, 2), 6)
def test_count_2(self):
self.assertEqual(CombinationCalculator.count(5, 3), 10)
def test_count_3(self):
self.assertEqual(Combination... | import math
from typing import List
class CombinationCalculator:
def __init__(self, datas: List[str]):
self.datas = datas
@staticmethod
def count(n: int, m: int) -> int:
if m == 0 or n == m:
return 1
return math.factorial(n) // (math.factorial(n - m) * math.factorial(m)... | [
"import math",
"from typing import List"
] | """
This is a class that provides methods to calculate the number of combinations for a specific count, calculate all possible combinations, and generate combinations with a specified number of elements.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [],
"lib_dependencies": [
"math"
],
"method_dependencies": []
},
"method_description": "def count(n: int, m: int) -> int:\n \"\"\"\n Calculate the number of combinations for a specific coun... | CombinationCalculator | [
"CombinationCalculatorTestCount",
"CombinationCalculatorTestCountAll",
"CombinationCalculatorTestSelect",
"CombinationCalculatorTestSelectAll",
"CombinationCalculatorTestSelect2",
"CombinationCalculatorTestMain"
] | class CombinationCalculator:
def __init__(self, datas: List[str]):
"""
Initialize the calculator with a list of data.
"""
self.datas = datas
| [
"self.datas"
] | ClassEval_23_m4 | _select | def _select(self, dataIndex: int, resultList: List[str], resultIndex: int, result: List[List[str]]): | import math
from typing import List
class CombinationCalculator:
def __init__(self, datas: List[str]):
self.datas = datas
@staticmethod
def count(n: int, m: int) -> int:
if m == 0 or n == m:
return 1
return math.factorial(n) // (math.factorial(n - m) * math.factorial(m)... |
ClassEval_24 | class ComplexCalculator:
"""
This is a class that implements addition, subtraction, multiplication, and division operations for complex numbers.
"""
def __init__(self):
pass
@staticmethod
def add(c1, c2):
"""
Adds two complex numbers.
:param c1: The first compl... | import unittest
class ComplexCalculatorTestAdd(unittest.TestCase):
def test_add(self):
complexCalculator = ComplexCalculator()
self.assertEqual(complexCalculator.add(1+2j, 3+4j), (4+6j))
def test_add_2(self):
complexCalculator = ComplexCalculator()
self.assertEqual(complexCalcu... | class ComplexCalculator:
def __init__(self):
pass
@staticmethod
def add(c1, c2):
real = c1.real + c2.real
imaginary = c1.imag + c2.imag
answer = complex(real, imaginary)
return answer
@staticmethod
def subtract(c1, c2):
real = c1.real - c2.real
... | [] | """
This is a class that implements addition, subtraction, multiplication, and division operations for complex numbers.
"""
| [
{
"dependencies": {
"Standalone": true,
"field_dependencies": [],
"lib_dependencies": [],
"method_dependencies": []
},
"method_description": "def add(c1, c2):\n \"\"\"\n Adds two complex numbers.\n :param c1: The first complex number,complex.\n :param ... | ComplexCalculator | [
"ComplexCalculatorTestAdd",
"ComplexCalculatorTestSubtract",
"ComplexCalculatorTestMultiply",
"ComplexCalculatorTestDivide",
"ComplexCalculatorTestMain"
] | class ComplexCalculator:
def __init__(self):
pass
| [] | ClassEval_24_m0 | add | def add(c1, c2): | class ComplexCalculator:
def __init__(self):
pass
@staticmethod
@staticmethod
def subtract(c1, c2):
real = c1.real - c2.real
imaginary = c1.imag - c2.imag
return complex(real, imaginary)
@staticmethod
def multiply(c1, c2):
real = c1.real * c2.re... |
ClassEval_24 | class ComplexCalculator:
"""
This is a class that implements addition, subtraction, multiplication, and division operations for complex numbers.
"""
def __init__(self):
pass
@staticmethod
def add(c1, c2):
"""
Adds two complex numbers.
:param c1: The first compl... | import unittest
class ComplexCalculatorTestAdd(unittest.TestCase):
def test_add(self):
complexCalculator = ComplexCalculator()
self.assertEqual(complexCalculator.add(1+2j, 3+4j), (4+6j))
def test_add_2(self):
complexCalculator = ComplexCalculator()
self.assertEqual(complexCalcu... | class ComplexCalculator:
def __init__(self):
pass
@staticmethod
def add(c1, c2):
real = c1.real + c2.real
imaginary = c1.imag + c2.imag
answer = complex(real, imaginary)
return answer
@staticmethod
def subtract(c1, c2):
real = c1.real - c2.real
... | [] | """
This is a class that implements addition, subtraction, multiplication, and division operations for complex numbers.
"""
| [
{
"dependencies": {
"Standalone": true,
"field_dependencies": [],
"lib_dependencies": [],
"method_dependencies": []
},
"method_description": "def add(c1, c2):\n \"\"\"\n Adds two complex numbers.\n :param c1: The first complex number,complex.\n :param ... | ComplexCalculator | [
"ComplexCalculatorTestAdd",
"ComplexCalculatorTestSubtract",
"ComplexCalculatorTestMultiply",
"ComplexCalculatorTestDivide",
"ComplexCalculatorTestMain"
] | class ComplexCalculator:
def __init__(self):
pass
| [] | ClassEval_24_m1 | subtract | def subtract(c1, c2): | class ComplexCalculator:
def __init__(self):
pass
@staticmethod
def add(c1, c2):
real = c1.real + c2.real
imaginary = c1.imag + c2.imag
answer = complex(real, imaginary)
return answer
@staticmethod
@staticmethod
def multiply(c1, c2):
rea... |
ClassEval_24 | class ComplexCalculator:
"""
This is a class that implements addition, subtraction, multiplication, and division operations for complex numbers.
"""
def __init__(self):
pass
@staticmethod
def add(c1, c2):
"""
Adds two complex numbers.
:param c1: The first compl... | import unittest
class ComplexCalculatorTestAdd(unittest.TestCase):
def test_add(self):
complexCalculator = ComplexCalculator()
self.assertEqual(complexCalculator.add(1+2j, 3+4j), (4+6j))
def test_add_2(self):
complexCalculator = ComplexCalculator()
self.assertEqual(complexCalcu... | class ComplexCalculator:
def __init__(self):
pass
@staticmethod
def add(c1, c2):
real = c1.real + c2.real
imaginary = c1.imag + c2.imag
answer = complex(real, imaginary)
return answer
@staticmethod
def subtract(c1, c2):
real = c1.real - c2.real
... | [] | """
This is a class that implements addition, subtraction, multiplication, and division operations for complex numbers.
"""
| [
{
"dependencies": {
"Standalone": true,
"field_dependencies": [],
"lib_dependencies": [],
"method_dependencies": []
},
"method_description": "def add(c1, c2):\n \"\"\"\n Adds two complex numbers.\n :param c1: The first complex number,complex.\n :param ... | ComplexCalculator | [
"ComplexCalculatorTestAdd",
"ComplexCalculatorTestSubtract",
"ComplexCalculatorTestMultiply",
"ComplexCalculatorTestDivide",
"ComplexCalculatorTestMain"
] | class ComplexCalculator:
def __init__(self):
pass
| [] | ClassEval_24_m2 | multiply | def multiply(c1, c2): | class ComplexCalculator:
def __init__(self):
pass
@staticmethod
def add(c1, c2):
real = c1.real + c2.real
imaginary = c1.imag + c2.imag
answer = complex(real, imaginary)
return answer
@staticmethod
def subtract(c1, c2):
real = c1.real - c2.real
... |
ClassEval_24 | class ComplexCalculator:
"""
This is a class that implements addition, subtraction, multiplication, and division operations for complex numbers.
"""
def __init__(self):
pass
@staticmethod
def add(c1, c2):
"""
Adds two complex numbers.
:param c1: The first compl... | import unittest
class ComplexCalculatorTestAdd(unittest.TestCase):
def test_add(self):
complexCalculator = ComplexCalculator()
self.assertEqual(complexCalculator.add(1+2j, 3+4j), (4+6j))
def test_add_2(self):
complexCalculator = ComplexCalculator()
self.assertEqual(complexCalcu... | class ComplexCalculator:
def __init__(self):
pass
@staticmethod
def add(c1, c2):
real = c1.real + c2.real
imaginary = c1.imag + c2.imag
answer = complex(real, imaginary)
return answer
@staticmethod
def subtract(c1, c2):
real = c1.real - c2.real
... | [] | """
This is a class that implements addition, subtraction, multiplication, and division operations for complex numbers.
"""
| [
{
"dependencies": {
"Standalone": true,
"field_dependencies": [],
"lib_dependencies": [],
"method_dependencies": []
},
"method_description": "def add(c1, c2):\n \"\"\"\n Adds two complex numbers.\n :param c1: The first complex number,complex.\n :param ... | ComplexCalculator | [
"ComplexCalculatorTestAdd",
"ComplexCalculatorTestSubtract",
"ComplexCalculatorTestMultiply",
"ComplexCalculatorTestDivide",
"ComplexCalculatorTestMain"
] | class ComplexCalculator:
def __init__(self):
pass
| [] | ClassEval_24_m3 | divide | def divide(c1, c2): | class ComplexCalculator:
def __init__(self):
pass
@staticmethod
def add(c1, c2):
real = c1.real + c2.real
imaginary = c1.imag + c2.imag
answer = complex(real, imaginary)
return answer
@staticmethod
def subtract(c1, c2):
real = c1.real - c2.real
... |
ClassEval_25 | import json
class CookiesUtil:
"""
This is a class as utility for managing and manipulating Cookies, including methods for retrieving, saving, and setting Cookies data.
"""
def __init__(self, cookies_file):
"""
Initializes the CookiesUtil with the specified cookies file.
:param... | import unittest
class CookiesUtilTestGetCookies(unittest.TestCase):
def test_get_cookies(self):
self.cookies_util = CookiesUtil('cookies.json')
self.response = {'cookies': {'key1': 'value1', 'key2': 'value2'}}
self.cookies_util.get_cookies(self.response)
self.assertEqual(self.cook... | import json
class CookiesUtil:
def __init__(self, cookies_file):
self.cookies_file = cookies_file
self.cookies = None
def get_cookies(self, reponse):
self.cookies = reponse['cookies']
self._save_cookies()
def load_cookies(self):
try:
with open(self.cook... | [
"import json"
] | """
This is a class as utility for managing and manipulating Cookies, including methods for retrieving, saving, and setting Cookies data.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [
"self.cookies"
],
"lib_dependencies": [],
"method_dependencies": [
"_save_cookies"
]
},
"method_description": "def get_cookies(self, reponse):\n \"\"\"\n Gets the cookies fr... | CookiesUtil | [
"CookiesUtilTestGetCookies",
"CookiesUtilTestLoadCookies",
"CookiesUtilTestSaveCookies",
"CookiesUtilTestSetCookies",
"CookiesUtilTestMain"
] | class CookiesUtil:
def __init__(self, cookies_file):
"""
Initializes the CookiesUtil with the specified cookies file.
:param cookies_file: The cookies file to use, str.
"""
self.cookies_file = cookies_file
self.cookies = None
| [
"self.cookies",
"self.cookies_file"
] | ClassEval_25_m0 | get_cookies | def get_cookies(self, reponse): | import json
class CookiesUtil:
def __init__(self, cookies_file):
self.cookies_file = cookies_file
self.cookies = None
def load_cookies(self):
try:
with open(self.cookies_file, 'r') as file:
cookies_data = json.load(file)
return cookies_data
... |
ClassEval_25 | import json
class CookiesUtil:
"""
This is a class as utility for managing and manipulating Cookies, including methods for retrieving, saving, and setting Cookies data.
"""
def __init__(self, cookies_file):
"""
Initializes the CookiesUtil with the specified cookies file.
:param... | import unittest
class CookiesUtilTestGetCookies(unittest.TestCase):
def test_get_cookies(self):
self.cookies_util = CookiesUtil('cookies.json')
self.response = {'cookies': {'key1': 'value1', 'key2': 'value2'}}
self.cookies_util.get_cookies(self.response)
self.assertEqual(self.cook... | import json
class CookiesUtil:
def __init__(self, cookies_file):
self.cookies_file = cookies_file
self.cookies = None
def get_cookies(self, reponse):
self.cookies = reponse['cookies']
self._save_cookies()
def load_cookies(self):
try:
with open(self.cook... | [
"import json"
] | """
This is a class as utility for managing and manipulating Cookies, including methods for retrieving, saving, and setting Cookies data.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [
"self.cookies"
],
"lib_dependencies": [],
"method_dependencies": [
"_save_cookies"
]
},
"method_description": "def get_cookies(self, reponse):\n \"\"\"\n Gets the cookies fr... | CookiesUtil | [
"CookiesUtilTestGetCookies",
"CookiesUtilTestLoadCookies",
"CookiesUtilTestSaveCookies",
"CookiesUtilTestSetCookies",
"CookiesUtilTestMain"
] | class CookiesUtil:
def __init__(self, cookies_file):
"""
Initializes the CookiesUtil with the specified cookies file.
:param cookies_file: The cookies file to use, str.
"""
self.cookies_file = cookies_file
self.cookies = None
| [
"self.cookies",
"self.cookies_file"
] | ClassEval_25_m1 | load_cookies | def load_cookies(self): | import json
class CookiesUtil:
def __init__(self, cookies_file):
self.cookies_file = cookies_file
self.cookies = None
def get_cookies(self, reponse):
self.cookies = reponse['cookies']
self._save_cookies()
def _save_cookies(self):
try:
with open(self.co... |
ClassEval_25 | import json
class CookiesUtil:
"""
This is a class as utility for managing and manipulating Cookies, including methods for retrieving, saving, and setting Cookies data.
"""
def __init__(self, cookies_file):
"""
Initializes the CookiesUtil with the specified cookies file.
:param... | import unittest
class CookiesUtilTestGetCookies(unittest.TestCase):
def test_get_cookies(self):
self.cookies_util = CookiesUtil('cookies.json')
self.response = {'cookies': {'key1': 'value1', 'key2': 'value2'}}
self.cookies_util.get_cookies(self.response)
self.assertEqual(self.cook... | import json
class CookiesUtil:
def __init__(self, cookies_file):
self.cookies_file = cookies_file
self.cookies = None
def get_cookies(self, reponse):
self.cookies = reponse['cookies']
self._save_cookies()
def load_cookies(self):
try:
with open(self.cook... | [
"import json"
] | """
This is a class as utility for managing and manipulating Cookies, including methods for retrieving, saving, and setting Cookies data.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [
"self.cookies"
],
"lib_dependencies": [],
"method_dependencies": [
"_save_cookies"
]
},
"method_description": "def get_cookies(self, reponse):\n \"\"\"\n Gets the cookies fr... | CookiesUtil | [
"CookiesUtilTestGetCookies",
"CookiesUtilTestLoadCookies",
"CookiesUtilTestSaveCookies",
"CookiesUtilTestSetCookies",
"CookiesUtilTestMain"
] | class CookiesUtil:
def __init__(self, cookies_file):
"""
Initializes the CookiesUtil with the specified cookies file.
:param cookies_file: The cookies file to use, str.
"""
self.cookies_file = cookies_file
self.cookies = None
| [
"self.cookies",
"self.cookies_file"
] | ClassEval_25_m2 | _save_cookies | def _save_cookies(self): | import json
class CookiesUtil:
def __init__(self, cookies_file):
self.cookies_file = cookies_file
self.cookies = None
def get_cookies(self, reponse):
self.cookies = reponse['cookies']
self._save_cookies()
def load_cookies(self):
try:
with open(self.cook... |
ClassEval_26 | import csv
class CSVProcessor:
"""
This is a class for processing CSV files, including readring and writing CSV data, as well as processing specific operations and saving as a new CSV file.
"""
def __init__(self):
pass
def read_csv(self, file_name):
"""
Read the csv file ... | import unittest
import os
class CSVProcessorTestReadCSV(unittest.TestCase):
def test_read_csv_1(self):
self.file = 'read_test.csv'
with open(self.file, 'w') as f:
f.write('a,b,c,d\nhElLo,YoU,ME,LoW')
expected_title = ['a', 'b', 'c', 'd']
expected_data = [['hElLo', 'Yo... | import csv
class CSVProcessor:
def __init__(self):
pass
def read_csv(self, file_name):
data = []
with open(file_name, 'r') as file:
reader = csv.reader(file)
title = next(reader)
for row in reader:
data.append(row)
return ti... | [
"import csv"
] | """
This is a class for processing CSV files, including readring and writing CSV data, as well as processing specific operations and saving as a new CSV file.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [],
"lib_dependencies": [
"csv"
],
"method_dependencies": []
},
"method_description": "def read_csv(self, file_name):\n \"\"\"\n Read the csv file by file_name, get the title and data from ... | CSVProcessor | [
"CSVProcessorTestReadCSV",
"CSVProcessorTestWriteCSV",
"CSVProcessorTestProcessCSVData",
"CSVProcessorTestMain"
] | class CSVProcessor:
def __init__(self):
pass
| [] | ClassEval_26_m0 | read_csv | def read_csv(self, file_name): | import csv
class CSVProcessor:
def __init__(self):
pass
def write_csv(self, data, file_name):
try:
with open(file_name, 'w', newline='') as file:
writer = csv.writer(file)
writer.writerows(data)
return 1
except:
ret... |
ClassEval_26 | import csv
class CSVProcessor:
"""
This is a class for processing CSV files, including readring and writing CSV data, as well as processing specific operations and saving as a new CSV file.
"""
def __init__(self):
pass
def read_csv(self, file_name):
"""
Read the csv file ... | import unittest
import os
class CSVProcessorTestReadCSV(unittest.TestCase):
def test_read_csv_1(self):
self.file = 'read_test.csv'
with open(self.file, 'w') as f:
f.write('a,b,c,d\nhElLo,YoU,ME,LoW')
expected_title = ['a', 'b', 'c', 'd']
expected_data = [['hElLo', 'Yo... | import csv
class CSVProcessor:
def __init__(self):
pass
def read_csv(self, file_name):
data = []
with open(file_name, 'r') as file:
reader = csv.reader(file)
title = next(reader)
for row in reader:
data.append(row)
return ti... | [
"import csv"
] | """
This is a class for processing CSV files, including readring and writing CSV data, as well as processing specific operations and saving as a new CSV file.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [],
"lib_dependencies": [
"csv"
],
"method_dependencies": []
},
"method_description": "def read_csv(self, file_name):\n \"\"\"\n Read the csv file by file_name, get the title and data from ... | CSVProcessor | [
"CSVProcessorTestReadCSV",
"CSVProcessorTestWriteCSV",
"CSVProcessorTestProcessCSVData",
"CSVProcessorTestMain"
] | class CSVProcessor:
def __init__(self):
pass
| [] | ClassEval_26_m1 | write_csv | def write_csv(self, data, file_name): | import csv
class CSVProcessor:
def __init__(self):
pass
def read_csv(self, file_name):
data = []
with open(file_name, 'r') as file:
reader = csv.reader(file)
title = next(reader)
for row in reader:
data.append(row)
return ti... |
ClassEval_26 | import csv
class CSVProcessor:
"""
This is a class for processing CSV files, including readring and writing CSV data, as well as processing specific operations and saving as a new CSV file.
"""
def __init__(self):
pass
def read_csv(self, file_name):
"""
Read the csv file ... | import unittest
import os
class CSVProcessorTestReadCSV(unittest.TestCase):
def test_read_csv_1(self):
self.file = 'read_test.csv'
with open(self.file, 'w') as f:
f.write('a,b,c,d\nhElLo,YoU,ME,LoW')
expected_title = ['a', 'b', 'c', 'd']
expected_data = [['hElLo', 'Yo... | import csv
class CSVProcessor:
def __init__(self):
pass
def read_csv(self, file_name):
data = []
with open(file_name, 'r') as file:
reader = csv.reader(file)
title = next(reader)
for row in reader:
data.append(row)
return ti... | [
"import csv"
] | """
This is a class for processing CSV files, including readring and writing CSV data, as well as processing specific operations and saving as a new CSV file.
"""
| [
{
"dependencies": {
"Standalone": false,
"field_dependencies": [],
"lib_dependencies": [
"csv"
],
"method_dependencies": []
},
"method_description": "def read_csv(self, file_name):\n \"\"\"\n Read the csv file by file_name, get the title and data from ... | CSVProcessor | [
"CSVProcessorTestReadCSV",
"CSVProcessorTestWriteCSV",
"CSVProcessorTestProcessCSVData",
"CSVProcessorTestMain"
] | class CSVProcessor:
def __init__(self):
pass
| [] | ClassEval_26_m2 | process_csv_data | def process_csv_data(self, N, save_file_name): | import csv
class CSVProcessor:
def __init__(self):
pass
def read_csv(self, file_name):
data = []
with open(file_name, 'r') as file:
reader = csv.reader(file)
title = next(reader)
for row in reader:
data.append(row)
return ti... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.