task_id
stringclasses
100 values
skeleton
stringclasses
100 values
test
stringclasses
100 values
solution_code
stringclasses
100 values
import_statement
listlengths
0
4
class_description
stringclasses
100 values
methods_info
listlengths
2
10
class_name
stringclasses
100 values
test_classes
listlengths
2
11
class_constructor
stringclasses
100 values
fields
listlengths
0
9
new_task_id
stringlengths
14
16
line_index
int64
0
75
method_name
stringclasses
379 values
method_signature
stringclasses
405 values
prefix
stringlengths
64
3.88k
solution
stringlengths
9
140
suffix
stringlengths
0
3.61k
ClassEval_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_t37
37
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',...
else:
return 'Player wins'
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_t38
38
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',...
return 'Player wins'
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_t0
0
add_book
def add_book(self, title, quantity=1):
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 not in self.inventory or self.inventory[title] < quantity: raise False self.inventory[title] -= quantity if self.inventory[ti...
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_t1
1
add_book
def add_book(self, title, quantity=1):
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 not in self.inventory or self.inventory[title] < quantity: raise False self.inventory[title] -= quantity if self.inventory[title] == 0: del (self.inventory[tit...
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_t2
2
add_book
def add_book(self, title, quantity=1):
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 not in self.inventory or self.inventory[title] < quantity: raise False self.inventory[title] -= quantity if self.inventory[title] == 0: del (self.inventory[title]) def ...
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_t3
3
add_book
def add_book(self, title, quantity=1):
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 not in self.inventory or self.inventory[title] < quantity: raise False self.inventory[title] -= quantity if self.inventory[title] == 0: del (self.inventory[title]) def view_inventory(self): return self.inv...
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_t4
4
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 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 (self.inventory[title]) def view_inventory(self): return self.inventory def view_book_quantity(self, title): if title not in self.inventory: return 0 ret...
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_t5
5
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 remove_book(self, title, quantity): if title...
raise False
self.inventory[title] -= quantity if self.inventory[title] == 0: del (self.inventory[title]) def view_inventory(self): return self.inventory def view_book_quantity(self, title): if title not in self.inventory: return 0 return self.inventory[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_t6
6
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 remove_book(self, title, quantity): if title...
self.inventory[title] -= quantity
if self.inventory[title] == 0: del (self.inventory[title]) def view_inventory(self): return self.inventory def view_book_quantity(self, title): if title not in self.inventory: return 0 return self.inventory[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_t7
7
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 remove_book(self, title, quantity): if title...
if self.inventory[title] == 0:
del (self.inventory[title]) def view_inventory(self): return self.inventory def view_book_quantity(self, title): if title not in self.inventory: return 0 return self.inventory[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_t8
8
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 remove_book(self, title, quantity): if title...
del (self.inventory[title])
def view_inventory(self): return self.inventory def view_book_quantity(self, title): if title not in self.inventory: return 0 return self.inventory[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_t9
9
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...
return self.inventory
def view_book_quantity(self, title): if title not in self.inventory: return 0 return self.inventory[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_t10
10
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...
if title not in self.inventory:
return 0 return self.inventory[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_t11
11
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...
return 0
return self.inventory[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_t12
12
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...
return self.inventory[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_t0
0
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 create_table(self):
self.cursor.execute('''
CREATE TABLE IF NOT EXISTS books ( id INTEGER PRIMARY KEY, title TEXT, author TEXT, available INTEGER ) ''') self.connection.commit() def add_book(self, title, author): self.cursor.execute(''' ...
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_t1
1
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 create_table(self): self.cursor.execute('''
CREATE TABLE IF NOT EXISTS books (
id INTEGER PRIMARY KEY, title TEXT, author TEXT, available INTEGER ) ''') self.connection.commit() def add_book(self, title, author): self.cursor.execute(''' INSERT INTO books (title, author, available) ...
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_t2
2
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 create_table(self): self.cursor.execute(''' CREATE TABLE IF NOT EXISTS books (
id INTEGER PRIMARY KEY,
title TEXT, author TEXT, available INTEGER ) ''') self.connection.commit() def add_book(self, title, author): self.cursor.execute(''' INSERT INTO books (title, author, available) VALUES (?, ?, 1) '''...
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_t3
3
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 create_table(self): self.cursor.execute(''' CREATE TABLE IF NOT EXISTS books ( ...
title TEXT,
author TEXT, available INTEGER ) ''') self.connection.commit() def add_book(self, title, author): self.cursor.execute(''' INSERT INTO books (title, author, available) VALUES (?, ?, 1) ''', (title, author)) s...
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_t4
4
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 create_table(self): self.cursor.execute(''' CREATE TABLE IF NOT EXISTS books ( ...
author TEXT,
available INTEGER ) ''') self.connection.commit() def add_book(self, title, author): self.cursor.execute(''' INSERT INTO books (title, author, available) VALUES (?, ?, 1) ''', (title, author)) self.connection.commit() ...
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_t5
5
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 create_table(self): self.cursor.execute(''' CREATE TABLE IF NOT EXISTS books ( ...
available INTEGER
) ''') self.connection.commit() def add_book(self, title, author): self.cursor.execute(''' INSERT INTO books (title, author, available) VALUES (?, ?, 1) ''', (title, author)) self.connection.commit() def remove_book(self, book_id): ...
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_t6
6
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 create_table(self): self.cursor.execute(''' CREATE TABLE IF NOT EXISTS books ( ...
)
''') self.connection.commit() def add_book(self, title, author): self.cursor.execute(''' INSERT INTO books (title, author, available) VALUES (?, ?, 1) ''', (title, author)) self.connection.commit() def remove_book(self, book_id): self.cur...
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_t7
7
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 create_table(self): self.cursor.execute(''' CREATE TABLE IF NOT EXISTS books ( ...
''')
self.connection.commit() def add_book(self, title, author): self.cursor.execute(''' INSERT INTO books (title, author, available) VALUES (?, ?, 1) ''', (title, author)) self.connection.commit() def remove_book(self, book_id): self.cursor.execute('...
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_t8
8
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 create_table(self): self.cursor.execute(''' CREATE TABLE IF NOT EXISTS books ( ...
self.connection.commit()
def add_book(self, title, author): self.cursor.execute(''' INSERT INTO books (title, author, available) VALUES (?, ?, 1) ''', (title, author)) self.connection.commit() def remove_book(self, book_id): self.cursor.execute(''' DELETE FROM 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_t9
9
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 ( ...
self.cursor.execute('''
INSERT INTO books (title, author, available) VALUES (?, ?, 1) ''', (title, author)) self.connection.commit() def remove_book(self, book_id): self.cursor.execute(''' DELETE FROM books WHERE id = ? ''', (book_id,)) self.connection.commit() ...
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_t10
10
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 ( ...
INSERT INTO books (title, author, available)
VALUES (?, ?, 1) ''', (title, author)) self.connection.commit() def remove_book(self, book_id): self.cursor.execute(''' DELETE FROM books WHERE id = ? ''', (book_id,)) self.connection.commit() def borrow_book(self, book_id): self.cursor.e...
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_t11
11
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 ( ...
VALUES (?, ?, 1)
''', (title, author)) self.connection.commit() def remove_book(self, book_id): self.cursor.execute(''' DELETE FROM books WHERE id = ? ''', (book_id,)) self.connection.commit() def borrow_book(self, book_id): self.cursor.execute(''' UPDATE...
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_t12
12
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 ( ...
''', (title, author))
self.connection.commit() def remove_book(self, book_id): self.cursor.execute(''' DELETE FROM books WHERE id = ? ''', (book_id,)) self.connection.commit() def borrow_book(self, book_id): self.cursor.execute(''' UPDATE books SET available = 0 WHERE...
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_t13
13
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 ( ...
self.connection.commit()
def remove_book(self, book_id): self.cursor.execute(''' DELETE FROM books WHERE id = ? ''', (book_id,)) self.connection.commit() def borrow_book(self, book_id): self.cursor.execute(''' UPDATE books SET available = 0 WHERE id = ? ''', (book_id,)) ...
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_t14
14
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 ( ...
self.cursor.execute('''
DELETE FROM books WHERE id = ? ''', (book_id,)) self.connection.commit() def borrow_book(self, book_id): self.cursor.execute(''' UPDATE books SET available = 0 WHERE id = ? ''', (book_id,)) self.connection.commit() def return_book(self, book_id):...
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_t15
15
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 ( ...
DELETE FROM books WHERE id = ?
''', (book_id,)) self.connection.commit() def borrow_book(self, book_id): self.cursor.execute(''' UPDATE books SET available = 0 WHERE id = ? ''', (book_id,)) self.connection.commit() def return_book(self, book_id): self.cursor.execute(''' ...
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_t16
16
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 ( ...
''', (book_id,))
self.connection.commit() def borrow_book(self, book_id): self.cursor.execute(''' UPDATE books SET available = 0 WHERE id = ? ''', (book_id,)) self.connection.commit() def return_book(self, book_id): self.cursor.execute(''' UPDATE books SET availa...
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_t17
17
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 ( ...
self.connection.commit()
def borrow_book(self, book_id): self.cursor.execute(''' UPDATE books SET available = 0 WHERE id = ? ''', (book_id,)) self.connection.commit() def return_book(self, book_id): self.cursor.execute(''' UPDATE books SET available = 1 WHERE id = ? ''',...
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_t18
18
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 ( ...
self.cursor.execute('''
UPDATE books SET available = 0 WHERE id = ? ''', (book_id,)) self.connection.commit() def return_book(self, book_id): self.cursor.execute(''' UPDATE books SET available = 1 WHERE id = ? ''', (book_id,)) self.connection.commit() def search_books(s...
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_t19
19
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 ( ...
UPDATE books SET available = 0 WHERE id = ?
''', (book_id,)) self.connection.commit() def return_book(self, book_id): self.cursor.execute(''' UPDATE books SET available = 1 WHERE id = ? ''', (book_id,)) self.connection.commit() def search_books(self): self.cursor.execute(''' SELECT...
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_t20
20
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 ( ...
''', (book_id,))
self.connection.commit() def return_book(self, book_id): self.cursor.execute(''' UPDATE books SET available = 1 WHERE id = ? ''', (book_id,)) self.connection.commit() def search_books(self): self.cursor.execute(''' SELECT * FROM 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_t21
21
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 ( ...
self.connection.commit()
def return_book(self, book_id): self.cursor.execute(''' UPDATE books SET available = 1 WHERE id = ? ''', (book_id,)) self.connection.commit() def search_books(self): self.cursor.execute(''' SELECT * FROM books ''') books = self.cursor.fet...
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_t22
22
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 ( ...
self.cursor.execute('''
UPDATE books SET available = 1 WHERE id = ? ''', (book_id,)) self.connection.commit() def search_books(self): self.cursor.execute(''' SELECT * FROM books ''') books = self.cursor.fetchall() return 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_t23
23
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 ( ...
UPDATE books SET available = 1 WHERE id = ?
''', (book_id,)) self.connection.commit() def search_books(self): self.cursor.execute(''' SELECT * FROM books ''') books = self.cursor.fetchall() return 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_t24
24
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 ( ...
''', (book_id,))
self.connection.commit() def search_books(self): self.cursor.execute(''' SELECT * FROM books ''') books = self.cursor.fetchall() return 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_t25
25
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 ( ...
self.connection.commit()
def search_books(self): self.cursor.execute(''' SELECT * FROM books ''') books = self.cursor.fetchall() return 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_t26
26
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 ( ...
self.cursor.execute('''
SELECT * FROM books ''') books = self.cursor.fetchall() return 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_t27
27
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 ( ...
SELECT * FROM books
''') books = self.cursor.fetchall() return 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_t28
28
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 ( ...
''')
books = self.cursor.fetchall() return 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_t29
29
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 ( ...
books = self.cursor.fetchall()
return 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_t30
30
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 ( ...
return 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_t0
0
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 match_in_pattern(self, char):
for i in range(self.patLen - 1, -1, -1):
if char == self.pattern[i]: return i return -1 def mismatch_in_text(self, currentPos): for i in range(self.patLen - 1, -1, -1): if self.pattern[i] != self.text[currentPos + i]: return currentPos + i return -1 def bad_character_heu...
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_t1
1
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 match_in_pattern(self, char): for i in range(self.patLen - 1, -1, -1):
if char == self.pattern[i]:
return i return -1 def mismatch_in_text(self, currentPos): for i in range(self.patLen - 1, -1, -1): if self.pattern[i] != self.text[currentPos + i]: return currentPos + i return -1 def bad_character_heuristic(self): positions = [] ...
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_t2
2
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 match_in_pattern(self, char): for i in range(self.patLen - 1, -1, -1): if char == self.pattern[i]:
return i
return -1 def mismatch_in_text(self, currentPos): for i in range(self.patLen - 1, -1, -1): if self.pattern[i] != self.text[currentPos + i]: return currentPos + i return -1 def bad_character_heuristic(self): positions = [] for i in range(self....
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_t3
3
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 match_in_pattern(self, char): for i in range(self.patLen - 1, -1, -1): if char == self.pattern[i]: retur...
return -1
def mismatch_in_text(self, currentPos): for i in range(self.patLen - 1, -1, -1): if self.pattern[i] != self.text[currentPos + i]: return currentPos + i return -1 def bad_character_heuristic(self): positions = [] for i in range(self.textLen - self.pat...
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_t4
4
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...
for i in range(self.patLen - 1, -1, -1):
if self.pattern[i] != self.text[currentPos + i]: return currentPos + i return -1 def bad_character_heuristic(self): positions = [] for i in range(self.textLen - self.patLen + 1): mismatch_index = self.mismatch_in_text(i) if mismatch_index ...
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_t5
5
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...
if self.pattern[i] != self.text[currentPos + i]:
return currentPos + i return -1 def bad_character_heuristic(self): positions = [] for i in range(self.textLen - self.patLen + 1): mismatch_index = self.mismatch_in_text(i) if mismatch_index == -1: positions.append(i) else: ...
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_t6
6
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...
return currentPos + i
return -1 def bad_character_heuristic(self): positions = [] for i in range(self.textLen - self.patLen + 1): mismatch_index = self.mismatch_in_text(i) if mismatch_index == -1: positions.append(i) else: match_index = self.mat...
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_t7
7
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...
return -1
def bad_character_heuristic(self): positions = [] for i in range(self.textLen - self.patLen + 1): mismatch_index = self.mismatch_in_text(i) if mismatch_index == -1: positions.append(i) else: match_index = self.match_in_pattern(self...
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_t8
8
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...
positions = []
for i in range(self.textLen - self.patLen + 1): mismatch_index = self.mismatch_in_text(i) if mismatch_index == -1: positions.append(i) else: match_index = self.match_in_pattern(self.text[mismatch_index]) i = (mismatch_index - ma...
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_t9
9
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...
for i in range(self.textLen - self.patLen + 1):
mismatch_index = self.mismatch_in_text(i) if mismatch_index == -1: positions.append(i) else: match_index = self.match_in_pattern(self.text[mismatch_index]) i = (mismatch_index - match_index) return positions
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_t10
10
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...
mismatch_index = self.mismatch_in_text(i)
if mismatch_index == -1: positions.append(i) else: match_index = self.match_in_pattern(self.text[mismatch_index]) i = (mismatch_index - match_index) return positions
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_t11
11
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...
if mismatch_index == -1:
positions.append(i) else: match_index = self.match_in_pattern(self.text[mismatch_index]) i = (mismatch_index - match_index) return positions
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_t12
12
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...
positions.append(i)
else: match_index = self.match_in_pattern(self.text[mismatch_index]) i = (mismatch_index - match_index) return positions
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_t13
13
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...
else:
match_index = self.match_in_pattern(self.text[mismatch_index]) i = (mismatch_index - match_index) return positions
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_t14
14
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...
match_index = self.match_in_pattern(self.text[mismatch_index])
i = (mismatch_index - match_index) return positions
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_t15
15
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...
i = (mismatch_index - match_index)
return positions
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_t16
16
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...
return positions
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_t0
0
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 calculate(self, expression):
operand_stack = []
operator_stack = [] num_buffer = '' for char in expression: if char.isdigit() or char == '.': num_buffer += char else: if num_buffer: operand_stack.append(float(num_buffer)) num_buffer = '' ...
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_t1
1
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 calculate(self, expression): operand_st...
operator_stack = []
num_buffer = '' for char in expression: if char.isdigit() or char == '.': num_buffer += char else: if num_buffer: operand_stack.append(float(num_buffer)) num_buffer = '' if char in '+-*/^': ...
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_t2
2
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 calculate(self, expression): operand_st...
num_buffer = ''
for char in expression: if char.isdigit() or char == '.': num_buffer += char else: if num_buffer: operand_stack.append(float(num_buffer)) num_buffer = '' if char in '+-*/^': whil...
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_t3
3
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 calculate(self, expression): operand_st...
for char in expression:
if char.isdigit() or char == '.': num_buffer += char else: if num_buffer: operand_stack.append(float(num_buffer)) num_buffer = '' if char in '+-*/^': while ( o...
ClassEval_16
class Calculator: """ This is a class for a calculator, capable of performing basic arithmetic calculations on numerical expressions using the operators +, -, *, /, and ^ (exponentiation). """ def __init__(self): """ Initialize the operations performed by the five operators'+','-','*','...
import unittest class CalculatorTestCalculate(unittest.TestCase): def test_calculate_1(self): calculator = Calculator() res = calculator.calculate('1+2') self.assertEqual(res, 3) def test_calculate_2(self): calculator = Calculator() res = calculator.calculate('1+2*3') ...
class Calculator: def __init__(self): self.operators = { '+': lambda x, y: x + y, '-': lambda x, y: x - y, '*': lambda x, y: x * y, '/': lambda x, y: x / y, '^': lambda x, y: x ** y } def calculate(self, expression): operand_st...
[]
""" This is a class for a calculator, capable of performing basic arithmetic calculations on numerical expressions using the operators +, -, *, /, and ^ (exponentiation). """
[ { "dependencies": { "Standalone": false, "field_dependencies": [], "lib_dependencies": [], "method_dependencies": [ "precedence", "apply_operator" ] }, "method_description": "def calculate(self, expression):\n \"\"\"\n Calculate the value of a ...
Calculator
[ "CalculatorTestCalculate", "CalculatorTestPrecedence", "CalculatorTestApplyOperator", "CalculatorTest" ]
class Calculator: def __init__(self): """ Initialize the operations performed by the five operators'+','-','*','/','^' """ self.operators = { '+': lambda x, y: x + y, '-': lambda x, y: x - y, '*': lambda x, y: x * y, '/': lambda x, y: ...
[ "self.operators" ]
ClassEval_16_t4
4
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 calculate(self, expression): operand_st...
if char.isdigit() or char == '.':
num_buffer += char else: if num_buffer: operand_stack.append(float(num_buffer)) num_buffer = '' if char in '+-*/^': while ( operator_stack and ...
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_t5
5
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 calculate(self, expression): operand_st...
num_buffer += char
else: if num_buffer: operand_stack.append(float(num_buffer)) num_buffer = '' if char in '+-*/^': while ( operator_stack and operator_stack[-1] != '(' and ...
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_t6
6
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 calculate(self, expression): operand_st...
else:
if num_buffer: operand_stack.append(float(num_buffer)) num_buffer = '' if char in '+-*/^': while ( operator_stack and operator_stack[-1] != '(' and ...
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_t7
7
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 calculate(self, expression): operand_st...
if num_buffer:
operand_stack.append(float(num_buffer)) num_buffer = '' if char in '+-*/^': while ( operator_stack and operator_stack[-1] != '(' and self.precedence(operator_s...
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_t8
8
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 calculate(self, expression): operand_st...
operand_stack.append(float(num_buffer))
num_buffer = '' if char in '+-*/^': while ( operator_stack and operator_stack[-1] != '(' and self.precedence(operator_stack[-1]) >= self.precedence(char) ): ...
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_t9
9
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 calculate(self, expression): operand_st...
num_buffer = ''
if char in '+-*/^': while ( operator_stack and operator_stack[-1] != '(' and self.precedence(operator_stack[-1]) >= self.precedence(char) ): operand_stack,...
ClassEval_16
class Calculator: """ This is a class for a calculator, capable of performing basic arithmetic calculations on numerical expressions using the operators +, -, *, /, and ^ (exponentiation). """ def __init__(self): """ Initialize the operations performed by the five operators'+','-','*','...
import unittest class CalculatorTestCalculate(unittest.TestCase): def test_calculate_1(self): calculator = Calculator() res = calculator.calculate('1+2') self.assertEqual(res, 3) def test_calculate_2(self): calculator = Calculator() res = calculator.calculate('1+2*3') ...
class Calculator: def __init__(self): self.operators = { '+': lambda x, y: x + y, '-': lambda x, y: x - y, '*': lambda x, y: x * y, '/': lambda x, y: x / y, '^': lambda x, y: x ** y } def calculate(self, expression): operand_st...
[]
""" This is a class for a calculator, capable of performing basic arithmetic calculations on numerical expressions using the operators +, -, *, /, and ^ (exponentiation). """
[ { "dependencies": { "Standalone": false, "field_dependencies": [], "lib_dependencies": [], "method_dependencies": [ "precedence", "apply_operator" ] }, "method_description": "def calculate(self, expression):\n \"\"\"\n Calculate the value of a ...
Calculator
[ "CalculatorTestCalculate", "CalculatorTestPrecedence", "CalculatorTestApplyOperator", "CalculatorTest" ]
class Calculator: def __init__(self): """ Initialize the operations performed by the five operators'+','-','*','/','^' """ self.operators = { '+': lambda x, y: x + y, '-': lambda x, y: x - y, '*': lambda x, y: x * y, '/': lambda x, y: ...
[ "self.operators" ]
ClassEval_16_t10
10
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 calculate(self, expression): operand_st...
if char in '+-*/^':
while ( operator_stack and operator_stack[-1] != '(' and self.precedence(operator_stack[-1]) >= self.precedence(char) ): operand_stack, operator_stack = self.apply_operator...
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_t11
11
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 calculate(self, expression): operand_st...
while (
operator_stack and operator_stack[-1] != '(' and self.precedence(operator_stack[-1]) >= self.precedence(char) ): operand_stack, operator_stack = self.apply_operator(operand_stack, operator_sta...
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_t12
12
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 calculate(self, expression): operand_st...
operator_stack and
operator_stack[-1] != '(' and self.precedence(operator_stack[-1]) >= self.precedence(char) ): operand_stack, operator_stack = self.apply_operator(operand_stack, operator_stack) operator_stack.append(...
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_t13
13
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 calculate(self, expression): operand_st...
operator_stack[-1] != '(' and
self.precedence(operator_stack[-1]) >= self.precedence(char) ): operand_stack, operator_stack = self.apply_operator(operand_stack, operator_stack) operator_stack.append(char) elif char == '(': ...
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_t14
14
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 calculate(self, expression): operand_st...
self.precedence(operator_stack[-1]) >= self.precedence(char)
): operand_stack, operator_stack = self.apply_operator(operand_stack, operator_stack) operator_stack.append(char) elif char == '(': operator_stack.append(char) elif char == ')': while...
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_t15
15
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 calculate(self, expression): operand_st...
):
operand_stack, operator_stack = self.apply_operator(operand_stack, operator_stack) operator_stack.append(char) elif char == '(': operator_stack.append(char) elif char == ')': while operator_stack and ope...
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_t16
16
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 calculate(self, expression): operand_st...
operand_stack, operator_stack = self.apply_operator(operand_stack, operator_stack)
operator_stack.append(char) elif char == '(': operator_stack.append(char) elif char == ')': while operator_stack and operator_stack[-1] != '(': operand_stack, operator_stack = self.apply_operator(operand...
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_t17
17
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 calculate(self, expression): operand_st...
operator_stack.append(char)
elif char == '(': operator_stack.append(char) elif char == ')': while operator_stack and operator_stack[-1] != '(': operand_stack, operator_stack = self.apply_operator(operand_stack, operator_stack) oper...
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_t18
18
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 calculate(self, expression): operand_st...
elif char == '(':
operator_stack.append(char) elif char == ')': while operator_stack and operator_stack[-1] != '(': operand_stack, operator_stack = self.apply_operator(operand_stack, operator_stack) operator_stack.pop() if num_b...
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_t19
19
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 calculate(self, expression): operand_st...
operator_stack.append(char)
elif char == ')': while operator_stack and operator_stack[-1] != '(': operand_stack, operator_stack = self.apply_operator(operand_stack, operator_stack) operator_stack.pop() if num_buffer: operand_stack.append(float(nu...
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_t20
20
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 calculate(self, expression): operand_st...
elif char == ')':
while operator_stack and operator_stack[-1] != '(': operand_stack, operator_stack = self.apply_operator(operand_stack, operator_stack) operator_stack.pop() if num_buffer: operand_stack.append(float(num_buffer)) while operator...
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_t21
21
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 calculate(self, expression): operand_st...
while operator_stack and operator_stack[-1] != '(':
operand_stack, operator_stack = self.apply_operator(operand_stack, operator_stack) operator_stack.pop() if num_buffer: operand_stack.append(float(num_buffer)) while operator_stack: operand_stack, operator_stack = self.apply_operator(...
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_t22
22
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 calculate(self, expression): operand_st...
operand_stack, operator_stack = self.apply_operator(operand_stack, operator_stack)
operator_stack.pop() if num_buffer: operand_stack.append(float(num_buffer)) while operator_stack: operand_stack, operator_stack = self.apply_operator(operand_stack, operator_stack) return operand_stack[-1] if operand_stack else None def preced...
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_t23
23
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 calculate(self, expression): operand_st...
operator_stack.pop()
if num_buffer: operand_stack.append(float(num_buffer)) while operator_stack: operand_stack, operator_stack = self.apply_operator(operand_stack, operator_stack) return operand_stack[-1] if operand_stack else None def precedence(self, operator): precedences ...
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_t24
24
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 calculate(self, expression): operand_st...
if num_buffer:
operand_stack.append(float(num_buffer)) while operator_stack: operand_stack, operator_stack = self.apply_operator(operand_stack, operator_stack) return operand_stack[-1] if operand_stack else None def precedence(self, operator): precedences = { '+': 1, ...
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_t25
25
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 calculate(self, expression): operand_st...
operand_stack.append(float(num_buffer))
while operator_stack: operand_stack, operator_stack = self.apply_operator(operand_stack, operator_stack) return operand_stack[-1] if operand_stack else None def precedence(self, operator): precedences = { '+': 1, '-': 1, '*': 2, ...
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_t26
26
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 calculate(self, expression): operand_st...
while operator_stack:
operand_stack, operator_stack = self.apply_operator(operand_stack, operator_stack) return operand_stack[-1] if operand_stack else None def precedence(self, operator): precedences = { '+': 1, '-': 1, '*': 2, '/': 2, '^': 3 ...
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_t27
27
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 calculate(self, expression): operand_st...
operand_stack, operator_stack = self.apply_operator(operand_stack, operator_stack)
return operand_stack[-1] if operand_stack else None def precedence(self, operator): precedences = { '+': 1, '-': 1, '*': 2, '/': 2, '^': 3 } return precedences.get(operator, 0) def apply_operator(self, operand_stack, ...
ClassEval_16
class Calculator: """ This is a class for a calculator, capable of performing basic arithmetic calculations on numerical expressions using the operators +, -, *, /, and ^ (exponentiation). """ def __init__(self): """ Initialize the operations performed by the five operators'+','-','*','...
import unittest class CalculatorTestCalculate(unittest.TestCase): def test_calculate_1(self): calculator = Calculator() res = calculator.calculate('1+2') self.assertEqual(res, 3) def test_calculate_2(self): calculator = Calculator() res = calculator.calculate('1+2*3') ...
class Calculator: def __init__(self): self.operators = { '+': lambda x, y: x + y, '-': lambda x, y: x - y, '*': lambda x, y: x * y, '/': lambda x, y: x / y, '^': lambda x, y: x ** y } def calculate(self, expression): operand_st...
[]
""" This is a class for a calculator, capable of performing basic arithmetic calculations on numerical expressions using the operators +, -, *, /, and ^ (exponentiation). """
[ { "dependencies": { "Standalone": false, "field_dependencies": [], "lib_dependencies": [], "method_dependencies": [ "precedence", "apply_operator" ] }, "method_description": "def calculate(self, expression):\n \"\"\"\n Calculate the value of a ...
Calculator
[ "CalculatorTestCalculate", "CalculatorTestPrecedence", "CalculatorTestApplyOperator", "CalculatorTest" ]
class Calculator: def __init__(self): """ Initialize the operations performed by the five operators'+','-','*','/','^' """ self.operators = { '+': lambda x, y: x + y, '-': lambda x, y: x - y, '*': lambda x, y: x * y, '/': lambda x, y: ...
[ "self.operators" ]
ClassEval_16_t28
28
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 calculate(self, expression): operand_st...
return operand_stack[-1] if operand_stack else None
def precedence(self, operator): precedences = { '+': 1, '-': 1, '*': 2, '/': 2, '^': 3 } return precedences.get(operator, 0) def apply_operator(self, operand_stack, operator_stack): operator = operator_stack.pop() ...
ClassEval_16
class Calculator: """ This is a class for a calculator, capable of performing basic arithmetic calculations on numerical expressions using the operators +, -, *, /, and ^ (exponentiation). """ def __init__(self): """ Initialize the operations performed by the five operators'+','-','*','...
import unittest class CalculatorTestCalculate(unittest.TestCase): def test_calculate_1(self): calculator = Calculator() res = calculator.calculate('1+2') self.assertEqual(res, 3) def test_calculate_2(self): calculator = Calculator() res = calculator.calculate('1+2*3') ...
class Calculator: def __init__(self): self.operators = { '+': lambda x, y: x + y, '-': lambda x, y: x - y, '*': lambda x, y: x * y, '/': lambda x, y: x / y, '^': lambda x, y: x ** y } def calculate(self, expression): operand_st...
[]
""" This is a class for a calculator, capable of performing basic arithmetic calculations on numerical expressions using the operators +, -, *, /, and ^ (exponentiation). """
[ { "dependencies": { "Standalone": false, "field_dependencies": [], "lib_dependencies": [], "method_dependencies": [ "precedence", "apply_operator" ] }, "method_description": "def calculate(self, expression):\n \"\"\"\n Calculate the value of a ...
Calculator
[ "CalculatorTestCalculate", "CalculatorTestPrecedence", "CalculatorTestApplyOperator", "CalculatorTest" ]
class Calculator: def __init__(self): """ Initialize the operations performed by the five operators'+','-','*','/','^' """ self.operators = { '+': lambda x, y: x + y, '-': lambda x, y: x - y, '*': lambda x, y: x * y, '/': lambda x, y: ...
[ "self.operators" ]
ClassEval_16_t29
29
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...
precedences = {
'+': 1, '-': 1, '*': 2, '/': 2, '^': 3 } return precedences.get(operator, 0) def apply_operator(self, operand_stack, operator_stack): operator = operator_stack.pop() if operator == '^': operand2 = operand_stack....
ClassEval_16
class Calculator: """ This is a class for a calculator, capable of performing basic arithmetic calculations on numerical expressions using the operators +, -, *, /, and ^ (exponentiation). """ def __init__(self): """ Initialize the operations performed by the five operators'+','-','*','...
import unittest class CalculatorTestCalculate(unittest.TestCase): def test_calculate_1(self): calculator = Calculator() res = calculator.calculate('1+2') self.assertEqual(res, 3) def test_calculate_2(self): calculator = Calculator() res = calculator.calculate('1+2*3') ...
class Calculator: def __init__(self): self.operators = { '+': lambda x, y: x + y, '-': lambda x, y: x - y, '*': lambda x, y: x * y, '/': lambda x, y: x / y, '^': lambda x, y: x ** y } def calculate(self, expression): operand_st...
[]
""" This is a class for a calculator, capable of performing basic arithmetic calculations on numerical expressions using the operators +, -, *, /, and ^ (exponentiation). """
[ { "dependencies": { "Standalone": false, "field_dependencies": [], "lib_dependencies": [], "method_dependencies": [ "precedence", "apply_operator" ] }, "method_description": "def calculate(self, expression):\n \"\"\"\n Calculate the value of a ...
Calculator
[ "CalculatorTestCalculate", "CalculatorTestPrecedence", "CalculatorTestApplyOperator", "CalculatorTest" ]
class Calculator: def __init__(self): """ Initialize the operations performed by the five operators'+','-','*','/','^' """ self.operators = { '+': lambda x, y: x + y, '-': lambda x, y: x - y, '*': lambda x, y: x * y, '/': lambda x, y: ...
[ "self.operators" ]
ClassEval_16_t30
30
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...
'+': 1,
'-': 1, '*': 2, '/': 2, '^': 3 } return precedences.get(operator, 0) def apply_operator(self, operand_stack, operator_stack): operator = operator_stack.pop() if operator == '^': operand2 = operand_stack.pop() op...
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_t31
31
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...
'-': 1,
'*': 2, '/': 2, '^': 3 } return precedences.get(operator, 0) def apply_operator(self, operand_stack, operator_stack): operator = operator_stack.pop() if operator == '^': operand2 = operand_stack.pop() operand1 = operand_sta...
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_t32
32
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...
'*': 2,
'/': 2, '^': 3 } return precedences.get(operator, 0) def apply_operator(self, operand_stack, operator_stack): operator = operator_stack.pop() if operator == '^': operand2 = operand_stack.pop() operand1 = operand_stack.pop() ...
ClassEval_16
class Calculator: """ This is a class for a calculator, capable of performing basic arithmetic calculations on numerical expressions using the operators +, -, *, /, and ^ (exponentiation). """ def __init__(self): """ Initialize the operations performed by the five operators'+','-','*','...
import unittest class CalculatorTestCalculate(unittest.TestCase): def test_calculate_1(self): calculator = Calculator() res = calculator.calculate('1+2') self.assertEqual(res, 3) def test_calculate_2(self): calculator = Calculator() res = calculator.calculate('1+2*3') ...
class Calculator: def __init__(self): self.operators = { '+': lambda x, y: x + y, '-': lambda x, y: x - y, '*': lambda x, y: x * y, '/': lambda x, y: x / y, '^': lambda x, y: x ** y } def calculate(self, expression): operand_st...
[]
""" This is a class for a calculator, capable of performing basic arithmetic calculations on numerical expressions using the operators +, -, *, /, and ^ (exponentiation). """
[ { "dependencies": { "Standalone": false, "field_dependencies": [], "lib_dependencies": [], "method_dependencies": [ "precedence", "apply_operator" ] }, "method_description": "def calculate(self, expression):\n \"\"\"\n Calculate the value of a ...
Calculator
[ "CalculatorTestCalculate", "CalculatorTestPrecedence", "CalculatorTestApplyOperator", "CalculatorTest" ]
class Calculator: def __init__(self): """ Initialize the operations performed by the five operators'+','-','*','/','^' """ self.operators = { '+': lambda x, y: x + y, '-': lambda x, y: x - y, '*': lambda x, y: x * y, '/': lambda x, y: ...
[ "self.operators" ]
ClassEval_16_t33
33
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...
'/': 2,
'^': 3 } return precedences.get(operator, 0) def apply_operator(self, operand_stack, operator_stack): operator = operator_stack.pop() if operator == '^': operand2 = operand_stack.pop() operand1 = operand_stack.pop() result = self.opera...
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_t34
34
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...
'^': 3
} return precedences.get(operator, 0) def apply_operator(self, operand_stack, operator_stack): operator = operator_stack.pop() if operator == '^': operand2 = operand_stack.pop() operand1 = operand_stack.pop() result = self.operators[operator](oper...
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_t35
35
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...
}
return precedences.get(operator, 0) def apply_operator(self, operand_stack, operator_stack): operator = operator_stack.pop() if operator == '^': operand2 = operand_stack.pop() operand1 = operand_stack.pop() result = self.operators[operator](operand1, oper...
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_t36
36
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...
return precedences.get(operator, 0)
def apply_operator(self, operand_stack, operator_stack): operator = operator_stack.pop() if operator == '^': operand2 = operand_stack.pop() operand1 = operand_stack.pop() result = self.operators[operator](operand1, operand2) operand_stack.append(resul...