Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
codecritic
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ziyuan Nan
codecritic
Commits
3a645a24
Commit
3a645a24
authored
Nov 25, 2024
by
nzy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bugs: gitignore
parent
fabd2413
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
4 deletions
+20
-4
.gitignore
+2
-4
codecritic/data/code.py
+18
-0
No files found.
.gitignore
View file @
3a645a24
...
...
@@ -162,6 +162,4 @@ cython_debug/
#.idea/
readme.pdf
test/
# temporary scripts
*.py
\ No newline at end of file
test/
\ No newline at end of file
codecritic/data/code.py
0 → 100644
View file @
3a645a24
import
re
codeblock_pattern
=
re
.
compile
(
r"```python(.+?)```"
,
flags
=
re
.
DOTALL
)
code_template
=
"""```python
{}
```
"""
def
extract_code
(
text
:
str
):
codes
=
[
match
.
strip
()
for
match
in
re
.
findall
(
codeblock_pattern
,
text
)]
if
len
(
codes
)
>
0
:
code
=
"
\n
"
.
join
(
codes
)
return
code
else
:
return
""
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment