Skip to content

Commit fc9e245

Browse files
committed
fix: 658 doc example
1 parent 38ad209 commit fc9e245

File tree

5 files changed

+1085
-1148
lines changed

5 files changed

+1085
-1148
lines changed

data/clean/f_658_xiaoheng.py

+2-23
Original file line numberDiff line numberDiff line change
@@ -22,29 +22,8 @@ def f_658(directory: str, pattern: str = r'^(.*?)-\d+\.csv$') -> list:
2222
- csv
2323
2424
Example:
25-
```python
26-
import re
27-
import os
28-
from pathlib import Path
29-
import csv
30-
31-
def f_658(directory: str, pattern: str = r'^(.*?)-\d+\.csv$') -> list:
32-
# Define the function body here...
33-
34-
# Create a test directory and some CSV files for testing
35-
test_dir = 'test_dir'
36-
os.makedirs(test_dir, exist_ok=True)
37-
with open(os.path.join(test_dir, 'file1-123.csv'), 'w', newline='') as f:
38-
writer = csv.writer(f)
39-
writer.writerow(['A', 'B', 'C'])
40-
with open(os.path.join(test_dir, 'file2-456.csv'), 'w', newline='') as f:
41-
writer = csv.writer(f)
42-
writer.writerow(['X', 'Y', 'Z'])
43-
44-
# Call the function for testing
45-
new_files = f_658(test_dir)
46-
print("New files created:", new_files)
47-
```
25+
>>> f_658("/mnt/data/test_data")
26+
['Shan.csv', 'Shannon.csv']
4827
"""
4928

5029
file_dir = Path(directory)

data/processed/771_wo_doc.py

+2-23
Original file line numberDiff line numberDiff line change
@@ -22,29 +22,8 @@ def task_func(directory: str, pattern: str = r'^(.*?)-\d+\.csv$') -> list:
2222
- csv
2323
2424
Example:
25-
```python
26-
import re
27-
import os
28-
from pathlib import Path
29-
import csv
30-
31-
def task_func(directory: str, pattern: str = r'^(.*?)-\d+\.csv$') -> list:
32-
# Define the function body here...
33-
34-
# Create a test directory and some CSV files for testing
35-
test_dir = 'test_dir'
36-
os.makedirs(test_dir, exist_ok=True)
37-
with open(os.path.join(test_dir, 'file1-123.csv'), 'w', newline='') as f:
38-
writer = csv.writer(f)
39-
writer.writerow(['A', 'B', 'C'])
40-
with open(os.path.join(test_dir, 'file2-456.csv'), 'w', newline='') as f:
41-
writer = csv.writer(f)
42-
writer.writerow(['X', 'Y', 'Z'])
43-
44-
# Call the function for testing
45-
new_files = task_func(test_dir)
46-
print("New files created:", new_files)
47-
```
25+
>>> task_func("/mnt/data/test_data")
26+
['Shan.csv', 'Shannon.csv']
4827
"""
4928
file_dir = Path(directory)
5029
file_pattern = re.compile(pattern)

data/raw/f_658_xiaoheng.py

+2-23
Original file line numberDiff line numberDiff line change
@@ -22,29 +22,8 @@ def f_658(directory: str, pattern: str = r'^(.*?)-\d+\.csv$') -> list:
2222
- csv
2323
2424
Example:
25-
```python
26-
import re
27-
import os
28-
from pathlib import Path
29-
import csv
30-
31-
def f_658(directory: str, pattern: str = r'^(.*?)-\d+\.csv$') -> list:
32-
# Define the function body here...
33-
34-
# Create a test directory and some CSV files for testing
35-
test_dir = 'test_dir'
36-
os.makedirs(test_dir, exist_ok=True)
37-
with open(os.path.join(test_dir, 'file1-123.csv'), 'w', newline='') as f:
38-
writer = csv.writer(f)
39-
writer.writerow(['A', 'B', 'C'])
40-
with open(os.path.join(test_dir, 'file2-456.csv'), 'w', newline='') as f:
41-
writer = csv.writer(f)
42-
writer.writerow(['X', 'Y', 'Z'])
43-
44-
# Call the function for testing
45-
new_files = f_658(test_dir)
46-
print("New files created:", new_files)
47-
```
25+
>>> f_658("/mnt/data/test_data")
26+
['Shan.csv', 'Shannon.csv']
4827
"""
4928

5029
file_dir = Path(directory)

0 commit comments

Comments
 (0)