Skip to content

Commit

Permalink
auto-accept honesty question when in R studio
Browse files Browse the repository at this point in the history
  • Loading branch information
rongxin-liu committed Jun 26, 2024
1 parent 146cebc commit 8ef8276
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@
entry_points={
"console_scripts": ["submit50=submit50.__main__:main"]
},
version="3.1.4",
version="3.1.5",
include_package_data=True
)
7 changes: 6 additions & 1 deletion submit50/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import enum
import gettext
import logging
import os
import re
import shutil
import sys
Expand Down Expand Up @@ -144,7 +145,11 @@ def prompt(honesty, included, excluded):
honesty_question = str(honesty)

# Get the user's answer
answer = input(honesty_question)
# If in R Studio environment, answer is always yes
if os.getenv("RSTUDIO") == "1":
answer = "yes"
else:
answer = input(honesty_question)
except EOFError:
answer = None
print()
Expand Down

1 comment on commit 8ef8276

@sarakarthikeyan
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This script uses the prompt function to handle user inputs and defaults to "yes" if the script is running in R Studio. The except hook function customizes how exceptions are reported, printing a user-friendly message and the traceback if verbose is enabled

Please sign in to comment.