Skip to content

Commit

Permalink
fix: 658 doc example
Browse files Browse the repository at this point in the history
  • Loading branch information
terryyz committed May 17, 2024
1 parent 38ad209 commit fc9e245
Show file tree
Hide file tree
Showing 5 changed files with 1,085 additions and 1,148 deletions.
25 changes: 2 additions & 23 deletions data/clean/f_658_xiaoheng.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,8 @@ def f_658(directory: str, pattern: str = r'^(.*?)-\d+\.csv$') -> list:
- csv
Example:
```python
import re
import os
from pathlib import Path
import csv
def f_658(directory: str, pattern: str = r'^(.*?)-\d+\.csv$') -> list:
# Define the function body here...
# Create a test directory and some CSV files for testing
test_dir = 'test_dir'
os.makedirs(test_dir, exist_ok=True)
with open(os.path.join(test_dir, 'file1-123.csv'), 'w', newline='') as f:
writer = csv.writer(f)
writer.writerow(['A', 'B', 'C'])
with open(os.path.join(test_dir, 'file2-456.csv'), 'w', newline='') as f:
writer = csv.writer(f)
writer.writerow(['X', 'Y', 'Z'])
# Call the function for testing
new_files = f_658(test_dir)
print("New files created:", new_files)
```
>>> f_658("/mnt/data/test_data")
['Shan.csv', 'Shannon.csv']
"""

file_dir = Path(directory)
Expand Down
25 changes: 2 additions & 23 deletions data/processed/771_wo_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,8 @@ def task_func(directory: str, pattern: str = r'^(.*?)-\d+\.csv$') -> list:
- csv
Example:
```python
import re
import os
from pathlib import Path
import csv
def task_func(directory: str, pattern: str = r'^(.*?)-\d+\.csv$') -> list:
# Define the function body here...
# Create a test directory and some CSV files for testing
test_dir = 'test_dir'
os.makedirs(test_dir, exist_ok=True)
with open(os.path.join(test_dir, 'file1-123.csv'), 'w', newline='') as f:
writer = csv.writer(f)
writer.writerow(['A', 'B', 'C'])
with open(os.path.join(test_dir, 'file2-456.csv'), 'w', newline='') as f:
writer = csv.writer(f)
writer.writerow(['X', 'Y', 'Z'])
# Call the function for testing
new_files = task_func(test_dir)
print("New files created:", new_files)
```
>>> task_func("/mnt/data/test_data")
['Shan.csv', 'Shannon.csv']
"""
file_dir = Path(directory)
file_pattern = re.compile(pattern)
Expand Down
25 changes: 2 additions & 23 deletions data/raw/f_658_xiaoheng.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,8 @@ def f_658(directory: str, pattern: str = r'^(.*?)-\d+\.csv$') -> list:
- csv
Example:
```python
import re
import os
from pathlib import Path
import csv
def f_658(directory: str, pattern: str = r'^(.*?)-\d+\.csv$') -> list:
# Define the function body here...
# Create a test directory and some CSV files for testing
test_dir = 'test_dir'
os.makedirs(test_dir, exist_ok=True)
with open(os.path.join(test_dir, 'file1-123.csv'), 'w', newline='') as f:
writer = csv.writer(f)
writer.writerow(['A', 'B', 'C'])
with open(os.path.join(test_dir, 'file2-456.csv'), 'w', newline='') as f:
writer = csv.writer(f)
writer.writerow(['X', 'Y', 'Z'])
# Call the function for testing
new_files = f_658(test_dir)
print("New files created:", new_files)
```
>>> f_658("/mnt/data/test_data")
['Shan.csv', 'Shannon.csv']
"""

file_dir = Path(directory)
Expand Down
Loading

0 comments on commit fc9e245

Please sign in to comment.