Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
snipper
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tuhe
snipper
Commits
754d22bc
Commit
754d22bc
authored
3 months ago
by
tuhe
Browse files
Options
Downloads
Patches
Plain Diff
Minor fixes
parent
747fc1d7
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/snipper/snipper_main.py
+10
-3
10 additions, 3 deletions
src/snipper/snipper_main.py
with
10 additions
and
3 deletions
src/snipper/snipper_main.py
+
10
−
3
View file @
754d22bc
...
...
@@ -7,6 +7,7 @@ from snipper.fix_s import save_s
from
snipper.fix_cite
import
fix_citations
from
snipper.fix_bf
import
fix_f
,
fix_b
from
snipper.fix_o
import
run_o
from
sphinx.ext.autodoc.preserve_defaults
import
update_defvalue
def
rem_nonprintable_ctrl_chars
(
txt
):
...
...
@@ -46,10 +47,15 @@ def censor_file(file, run_files=True, run_out_dirs=None, cut_files=True,
strict
=
True
,
references
=
None
,
license_head
=
None
,
package_base_dir
=
None
):
package_base_dir
=
None
,
update_file
=
True
# Update the file 'file' (i.e., write to it).
):
if
str
(
file
).
endswith
(
"
rst
"
):
assert
not
run_files
and
not
cut_files
and
not
censor_files
if
censor_files
:
assert
update_file
,
"
update_file must be true when censor_files is true (otherwise the file will not be censored!)
"
if
str
(
file
).
endswith
(
"
.md
"
):
license_head
=
None
...
...
@@ -108,6 +114,7 @@ def censor_file(file, run_files=True, run_out_dirs=None, cut_files=True,
if
license_head
is
not
None
:
s2
=
fix_copyright
(
s2
,
license_head
)
if
update_file
:
with
open
(
file
,
'
w
'
,
encoding
=
'
utf-8
'
)
as
f
:
f
.
write
(
s2
)
return
nB
,
cut
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment