Skip to content

Commit

Permalink
fix: fix 4524
Browse files Browse the repository at this point in the history
  • Loading branch information
terryyz committed May 2, 2024
1 parent 2a57200 commit 237cd18
Show file tree
Hide file tree
Showing 29 changed files with 730 additions and 664 deletions.
3 changes: 3 additions & 0 deletions data/clean/f_387_jenny.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ def f_387(epoch_milliseconds, seed=0):
- 'Time': The timestamp of when the activity occurred, incrementally
increasing from the starting epoch time to the current time.
Raises:
- ValueError: If the start time is after the current system time.
Requirements:
- pandas
- datetime.datetime.fromtimestamp
Expand Down
3 changes: 3 additions & 0 deletions data/clean/f_388_jenny.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ def f_388(epoch_milliseconds, seed=None):
- sales_data (dict): Sales data for different categories over days.
- ax (plt.Axes): The plot depicting the sales trend.
Raises:
- ValueError: If the start time is negative or after the current time.
Requirements:
- random
- datetime.datetime
Expand Down
3 changes: 3 additions & 0 deletions data/clean/f_393_jenny.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ def f_393(days_in_past=7, random_seed=0):
with 'Date' on the a-xis and 'Temperature (°C)' on the y-axis.
Raises:
ValueError: If days_in_past is less than 1.
Requirements:
- datetime.datetime
- datetime.timedelta
Expand Down
3 changes: 3 additions & 0 deletions data/clean/f_394_jenny.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ def f_394(days_in_past=7):
Returns:
weekday (str) : The name of the weekday (e.g., 'Monday', 'Tuesday') for the computed date.
Raises:
ValueError: If 'days_in_past' is negative.
Requirements:
- datetime.datetime
- datetime.timedelta
Expand Down
4 changes: 3 additions & 1 deletion data/clean/f_398_jenny.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ def f_398(column, data):
- data (list of lists): A list where each element is a list representing stock data for a single day.
Each inner list should contain values in the following order:
'Date', 'Open', 'High', 'Low', 'Close', 'Volume'.
Function will raise ValueError if the structure is not as expected.
Returns:
- dict: A dictionary containing the calculated 'sum', 'mean', 'min' (minimum), and 'max' (maximum)
for the specified column. If the input data is empty, 'sum' will be 0, and 'mean', 'min', and
Expand All @@ -23,6 +22,9 @@ def f_398(column, data):
- pandas
- numpy
Raises:
- ValueError: If the specified column name is not valid.
Example:
>>> data = [[datetime(2022, 1, 1), 100, 105, 95, 102, 10000]]
>>> results = f_398('Open', data)
Expand Down
2 changes: 1 addition & 1 deletion data/clean/f_399_jenny.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def f_399(column, data):
Returns:
tuple: A tuple containing:
- dict: A dictionary with the sum, mean, min, and max of the column.
- dict: A dictionary with the 'sum', 'mean', 'min', and 'max' of the column.
- Axes object: The pie chart visualizing the column data.
Requirements:
Expand Down
3 changes: 3 additions & 0 deletions data/clean/f_400_jenny.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ def f_400(column, data):
- pandas
- numpy
Raises:
- ValueError: If the quantity sold or total sales is negative.
Example:
>>> data = [['Product A', 100, 10000], ['Product B', 150, 15000], ['Product C', 200, 20000]]
>>> stats, plot = f_400('Total Sales', data)
Expand Down
4 changes: 4 additions & 0 deletions data/clean/f_401_jenny.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ def f_401(column, data):
- numpy
- matplotlib.pyplot
Raises:
- KeyError: If the specified column is not valid.
- ValueError: If the data list is empty or if any of the numeric values for
steps, calories burned, and distance walked are negative.
Example:
>>> data = [[datetime(2022, 1, 1), 5000, 200, 3.5],
... [datetime(2022, 1, 2), 5500, 220, 4.0],
Expand Down
15 changes: 8 additions & 7 deletions data/clean/f_4524_hanhu.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,34 +65,34 @@ def test_return_type(self):
pub_key, filename, _, _ = f_4526()
self.assertIsInstance(pub_key, rsa.PublicKey)
self.assertIsInstance(filename, str)
TestCases.filenames.append(filename)
self.filenames.append(filename)

def test_file_creation(self):
_, filename, _, _ = f_4526()
self.assertTrue(os.path.exists(filename))
TestCases.filenames.append(filename)
self.filenames.append(filename)

def test_file_content(self):
_, filename, _, _ = f_4526()
with open(filename, 'r') as f:
content = f.read()
self.assertTrue(content)
TestCases.filenames.append(filename)
self.filenames.append(filename)

def test_key_size(self):
pub_key, filename, _, _ = f_4526()
self.assertEqual(pub_key.n.bit_length(), 512)
TestCases.filenames.append(filename)
self.filenames.append(filename)

def test_unique_file_per_call(self):
_, filename1, _, _ = f_4526()
_, filename2, _, _ = f_4526()
self.assertNotEqual(filename1, filename2)
TestCases.filenames.extend([filename1, filename2])
self.filenames.extend([filename1, filename2])

def test_encryption_decryption(self):
pub_key, filename, password, nonce = f_4526()
TestCases.filenames.append(filename)
self.filenames.append(filename)
with open(filename, 'r') as f:
encrypted_key = b64decode(f.read())
cipher = AES.new(password, AES.MODE_EAX, nonce=nonce)
Expand All @@ -103,7 +103,8 @@ def test_encryption_decryption(self):

def tearDown(self):
for filename in self.filenames:
os.remove(filename)
if os.path.exists(filename):
os.remove(filename)


def run_tests():
Expand Down
1,274 changes: 637 additions & 637 deletions data/open-eval.jsonl

Large diffs are not rendered by default.

Binary file modified data/open-eval.jsonl.gz
Binary file not shown.
3 changes: 3 additions & 0 deletions data/processed/f_387_jenny_wo_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ def f_519(epoch_milliseconds, seed=0):
- 'Time': The timestamp of when the activity occurred, incrementally
increasing from the starting epoch time to the current time.
Raises:
- ValueError: If the start time is after the current system time.
Requirements:
- pandas
- datetime.datetime.fromtimestamp
Expand Down
3 changes: 3 additions & 0 deletions data/processed/f_388_jenny_wo_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ def f_2(epoch_milliseconds, seed=None):
- sales_data (dict): Sales data for different categories over days.
- ax (plt.Axes): The plot depicting the sales trend.
Raises:
- ValueError: If the start time is negative or after the current time.
Requirements:
- random
- datetime.datetime
Expand Down
3 changes: 3 additions & 0 deletions data/processed/f_393_jenny_wo_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ def f_659(days_in_past=7, random_seed=0):
with 'Date' on the a-xis and 'Temperature (°C)' on the y-axis.
Raises:
ValueError: If days_in_past is less than 1.
Requirements:
- datetime.datetime
- datetime.timedelta
Expand Down
3 changes: 3 additions & 0 deletions data/processed/f_394_jenny_wo_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ def f_103(days_in_past=7):
Returns:
weekday (str) : The name of the weekday (e.g., 'Monday', 'Tuesday') for the computed date.
Raises:
ValueError: If 'days_in_past' is negative.
Requirements:
- datetime.datetime
- datetime.timedelta
Expand Down
4 changes: 3 additions & 1 deletion data/processed/f_398_jenny_w_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ def f_581(column, data):
- data (list of lists): A list where each element is a list representing stock data for a single day.
Each inner list should contain values in the following order:
'Date', 'Open', 'High', 'Low', 'Close', 'Volume'.
Function will raise ValueError if the structure is not as expected.
Returns:
- dict: A dictionary containing the calculated 'sum', 'mean', 'min' (minimum), and 'max' (maximum)
for the specified column. If the input data is empty, 'sum' will be 0, and 'mean', 'min', and
Expand All @@ -23,6 +22,9 @@ def f_581(column, data):
- pandas
- numpy
Raises:
- ValueError: If the specified column name is not valid.
Example:
>>> data = [[datetime(2022, 1, 1), 100, 105, 95, 102, 10000]]
>>> results = f_581('Open', data)
Expand Down
2 changes: 1 addition & 1 deletion data/processed/f_399_jenny_w_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def f_85(column, data):
Returns:
tuple: A tuple containing:
- dict: A dictionary with the sum, mean, min, and max of the column.
- dict: A dictionary with the 'sum', 'mean', 'min', and 'max' of the column.
- Axes object: The pie chart visualizing the column data.
Requirements:
Expand Down
3 changes: 3 additions & 0 deletions data/processed/f_400_jenny_w_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ def f_256(column, data):
- pandas
- numpy
Raises:
- ValueError: If the quantity sold or total sales is negative.
Example:
>>> data = [['Product A', 100, 10000], ['Product B', 150, 15000], ['Product C', 200, 20000]]
>>> stats, plot = f_256('Total Sales', data)
Expand Down
4 changes: 4 additions & 0 deletions data/processed/f_401_jenny_w_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ def f_183(column, data):
- numpy
- matplotlib.pyplot
Raises:
- KeyError: If the specified column is not valid.
- ValueError: If the data list is empty or if any of the numeric values for
steps, calories burned, and distance walked are negative.
Example:
>>> data = [[datetime(2022, 1, 1), 5000, 200, 3.5],
... [datetime(2022, 1, 2), 5500, 220, 4.0],
Expand Down
15 changes: 8 additions & 7 deletions data/processed/f_4524_hanhu_wo_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,29 +63,29 @@ def test_return_type(self):
pub_key, filename, _, _ = f_350()
self.assertIsInstance(pub_key, rsa.PublicKey)
self.assertIsInstance(filename, str)
TestCases.filenames.append(filename)
self.filenames.append(filename)
def test_file_creation(self):
_, filename, _, _ = f_350()
self.assertTrue(os.path.exists(filename))
TestCases.filenames.append(filename)
self.filenames.append(filename)
def test_file_content(self):
_, filename, _, _ = f_350()
with open(filename, 'r') as f:
content = f.read()
self.assertTrue(content)
TestCases.filenames.append(filename)
self.filenames.append(filename)
def test_key_size(self):
pub_key, filename, _, _ = f_350()
self.assertEqual(pub_key.n.bit_length(), 512)
TestCases.filenames.append(filename)
self.filenames.append(filename)
def test_unique_file_per_call(self):
_, filename1, _, _ = f_350()
_, filename2, _, _ = f_350()
self.assertNotEqual(filename1, filename2)
TestCases.filenames.extend([filename1, filename2])
self.filenames.extend([filename1, filename2])
def test_encryption_decryption(self):
pub_key, filename, password, nonce = f_350()
TestCases.filenames.append(filename)
self.filenames.append(filename)
with open(filename, 'r') as f:
encrypted_key = b64decode(f.read())
cipher = AES.new(password, AES.MODE_EAX, nonce=nonce)
Expand All @@ -95,4 +95,5 @@ def test_encryption_decryption(self):
self.assertIsInstance(priv_key, rsa.PrivateKey)
def tearDown(self):
for filename in self.filenames:
os.remove(filename)
if os.path.exists(filename):
os.remove(filename)
3 changes: 3 additions & 0 deletions data/raw/f_387_jenny.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ def f_387(epoch_milliseconds, seed=0):
- 'Time': The timestamp of when the activity occurred, incrementally
increasing from the starting epoch time to the current time.
Raises:
- ValueError: If the start time is after the current system time.
Requirements:
- pandas
- datetime.datetime.fromtimestamp
Expand Down
3 changes: 3 additions & 0 deletions data/raw/f_388_jenny.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ def f_388(epoch_milliseconds, seed=None):
- sales_data (dict): Sales data for different categories over days.
- ax (plt.Axes): The plot depicting the sales trend.
Raises:
- ValueError: If the start time is negative or after the current time.
Requirements:
- random
- datetime.datetime
Expand Down
3 changes: 3 additions & 0 deletions data/raw/f_393_jenny.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ def f_393(days_in_past=7, random_seed=0):
with 'Date' on the a-xis and 'Temperature (°C)' on the y-axis.
Raises:
ValueError: If days_in_past is less than 1.
Requirements:
- datetime.datetime
- datetime.timedelta
Expand Down
3 changes: 3 additions & 0 deletions data/raw/f_394_jenny.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ def f_394(days_in_past=7):
Returns:
weekday (str) : The name of the weekday (e.g., 'Monday', 'Tuesday') for the computed date.
Raises:
ValueError: If 'days_in_past' is negative.
Requirements:
- datetime.datetime
- datetime.timedelta
Expand Down
4 changes: 3 additions & 1 deletion data/raw/f_398_jenny.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ def f_398(column, data):
- data (list of lists): A list where each element is a list representing stock data for a single day.
Each inner list should contain values in the following order:
'Date', 'Open', 'High', 'Low', 'Close', 'Volume'.
Function will raise ValueError if the structure is not as expected.
Returns:
- dict: A dictionary containing the calculated 'sum', 'mean', 'min' (minimum), and 'max' (maximum)
for the specified column. If the input data is empty, 'sum' will be 0, and 'mean', 'min', and
Expand All @@ -23,6 +22,9 @@ def f_398(column, data):
- pandas
- numpy
Raises:
- ValueError: If the specified column name is not valid.
Example:
>>> data = [[datetime(2022, 1, 1), 100, 105, 95, 102, 10000]]
>>> results = f_398('Open', data)
Expand Down
2 changes: 1 addition & 1 deletion data/raw/f_399_jenny.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def f_399(column, data):
Returns:
tuple: A tuple containing:
- dict: A dictionary with the sum, mean, min, and max of the column.
- dict: A dictionary with the 'sum', 'mean', 'min', and 'max' of the column.
- Axes object: The pie chart visualizing the column data.
Requirements:
Expand Down
3 changes: 3 additions & 0 deletions data/raw/f_400_jenny.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ def f_400(column, data):
- pandas
- numpy
Raises:
- ValueError: If the quantity sold or total sales is negative.
Example:
>>> data = [['Product A', 100, 10000], ['Product B', 150, 15000], ['Product C', 200, 20000]]
>>> stats, plot = f_400('Total Sales', data)
Expand Down
4 changes: 4 additions & 0 deletions data/raw/f_401_jenny.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ def f_401(column, data):
- numpy
- matplotlib.pyplot
Raises:
- KeyError: If the specified column is not valid.
- ValueError: If the data list is empty or if any of the numeric values for
steps, calories burned, and distance walked are negative.
Example:
>>> data = [[datetime(2022, 1, 1), 5000, 200, 3.5],
... [datetime(2022, 1, 2), 5500, 220, 4.0],
Expand Down
Loading

0 comments on commit 237cd18

Please sign in to comment.