-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from PrincetonUniversity/lint_deploy
- Loading branch information
Showing
14 changed files
with
903 additions
and
583 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[lint] | ||
ignore = ["E741"] |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,28 @@ | ||
import os | ||
import shutil | ||
|
||
|
||
def copy_file(fn_old, fn_new): | ||
"""Copy file from old to new location. Make new directory if needed. | ||
Raise warning if old file does not exist. | ||
inputs: | ||
fn_old: string, old filename | ||
fn_new: string, new filename""" | ||
if fn_old == fn_new: | ||
raise ValueError('New filename cannot be the same as the original one.') | ||
raise ValueError("New filename cannot be the same as the original one.") | ||
if os.path.isfile(fn_old): | ||
if os.path.isfile(fn_new): | ||
print("New file already exists: "+fn_new) | ||
print("New file already exists: " + fn_new) | ||
while True: | ||
answer = input("Overwrite? (y/n):") | ||
if answer == "y": | ||
break | ||
elif answer == "n": | ||
return | ||
return | ||
dir_new = os.path.dirname(fn_new) | ||
if not os.path.exists(dir_new): | ||
os.makedirs(dir_new) | ||
shutil.copyfile(fn_old, fn_new) | ||
else: | ||
raise RuntimeError("file does not exist: "+fn_old) | ||
raise RuntimeError("file does not exist: " + fn_old) | ||
return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.