-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hotfix/routine default file overwrite #4927
Hotfix/routine default file overwrite #4927
Conversation
…erge-fix hotfix / pywry bump
…-installer hotfix/ fix windows pyinstaller subprocess fail if space in path
…personal routines in difference folders and changed logic in call_dowload in account controller to account for the change in logic for save_routine
…ry structure and also changed the corresponding unit tests. Slightly amended test_save_routine to account for the new routine param
…_with to account for the change in the input parameter of the save_routine function
Hi, thanks for the PR. IIUC, if I create a routine with name already in use by default routines like Did you consider how to run the personal routine with the same name? The simple way to achieve this would be to specify the full path |
Hello , I missed that and did not take that the exe command after the user logs in into consideration. I know where the issue is and will push the changes when I am done. |
…h --file default/filename.openbb, --file personal/filename.openbb or --file Users/Username/openBBUserData/Routines/hub/default/filename.openbb
Hi Monte, I have pushed the changes. |
Hi, apparently Otherwise, I get this (since I'm on mac). Windows user might not use C drive as well. So it's better to force user to specify that if needed. Error: [Errno 2] No such file or directory: 'C:/Users/username/OpenBBUserData/routines/hub/personal/The Influence of the Central Bank.openbb' |
file_path = " ".join(ns_parser.file) | ||
path = self.ROUTINE_FILES.get(file_path, Path(file_path)) | ||
full_path = Path('C:/' + re.sub(r'^(C:\/?|c:\/?)', '', file_path).strip()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
full_path = Path('C:/' + re.sub(r'^(C:\/?|c:\/?)', '', file_path).strip()) | |
full_path = file_path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure why it is not working with the regex for you as it is the opposite for me and
exe --file /Users/username/OpenBBUserData/routines/hub/personal/The Influence of the Central Bank.openbb only works for me with the regex otherwise i need to include the C drive at the start for it to work without regex.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But I guess it is better to remove the regex as the full path with the C:/ at the start still works with or without it. The purpose of the regex was for users to be able to choose to include the C;/ or not include it and the path will still work but at the end of the day the issue seems trivial and it was simply for convenience
@@ -403,32 +405,32 @@ def call_download(self, other_args: List[str]): | |||
# Default routine |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we should give priority to user routines if there's a naming conflict.
name = " ".join(ns_parser.name)
if name in self.REMOTE_CHOICES:
# User routine
response = Hub.download_routine(
auth_header=get_current_user().profile.get_auth_header(),
name=name,
)
data = [
(
response.json()
if response and response.status_code == 200
else None
),
"personal",
]
else:
# Default routine
data = [
next(
(r for r in self.DEFAULT_ROUTINES if r["name"] == name),
None,
),
"default",
]
I've made a couple suggestions and fixed linting, other than that looks good to me! |
Thank you! |
…personal routines priority
…write' into hotfix/routine_default_file_overwrite # Conflicts: # openbb_terminal/account/account_controller.py # openbb_terminal/terminal_controller.py
…solve linting issue. Changed routine args type annotation Changed data list
1f0c3ff
Description
- Summary of the change / bug fix.
- Link to the issue
- Relevant motivation and context.
- dependencies
How has this been tested?
-Please describe the tests that you ran to verify your changes.
-Provide instructions so we can reproduce.
-Please also list any relevant details for your test configuration.
Checklist:
feature/feature-name
orhotfix/hotfix-name
.Others