generated from cds-snc/project-template
-
Notifications
You must be signed in to change notification settings - Fork 1
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
Refactor/google drive module #392
Merged
Merged
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
126832f
fix: render commands available in dev only
gcharest 3f0aa59
fix: move google-service command to bottom
gcharest 4355ba8
feat: make test command available in dev only
gcharest 3cc40c7
fix: fix mypy path for current project structure
gcharest a1ad43f
fix: update pylint cwd
gcharest 060b0bd
fix: ignore google.oauth2 missing stub warning
gcharest 4774214
fix: config flake8 instead of pylint
gcharest f2ec771
feat: add a decorator to handle api calls errors
gcharest 2555afb
feat: refactor basic drive functions
gcharest 6070afe
feat: add get_file_by_name function
gcharest 97fa78e
feat: add list metadata function
gcharest f875a9b
feat: use new drive module functions
gcharest c087c41
fix: shorten test command
gcharest cf65333
fix: handle invalid folder
gcharest b1b5de1
feat: modify wrapper to provide context
gcharest 463464d
fix: add missing parameter to list_metadata
gcharest 83f2fa6
fix: surround function name w/ single quotes
gcharest fead205
fix: google drive healthcheck
gcharest 61d8c68
fix: matching error message
gcharest 0011722
feat: add healtcheck message
gcharest 890ff08
fix: update module docstrings w/ more details
gcharest 6c344f6
fix: remove import from google_service
gcharest 02788a7
fix: update module docstring
gcharest 332a5fe
feat: add basic docstring for Docs module
gcharest aa88af7
fix: replicate current tests for conformity
gcharest 24c101e
fix: add loop to handle pagination
gcharest 2a0a993
fix: ensure all files are returned
gcharest 68a262c
fix: add test to handle pagination
gcharest 129fcdd
fix: log errors
gcharest dab733e
fix: remove unused variables
gcharest 40d4413
feat: include ValueError logging in the wrapper function
gcharest 3b73968
fix: adjust tests to handle logging errors
gcharest 4ad41da
fix: test names
gcharest dda6090
fix: lint
gcharest File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
{ | ||
"python.pylintPath": "/usr/local/py-utils/bin/pylint", | ||
"mypy-type-checker.cwd": "${workspaceFolder}/app", | ||
"pylint.cwd": "${workspaceFolder}/app", | ||
"pylint.path": [ | ||
"[\"../../usr/local/py-utils/bin/pylint\"]" | ||
], | ||
"flake8.cwd": "${workspaceFolder}/app" | ||
} |
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 |
---|---|---|
|
@@ -21,6 +21,8 @@ | |
\n - show the version of the SRE Bot | ||
\n - montre la version du bot SRE""" | ||
|
||
PREFIX = os.environ.get("PREFIX", "") | ||
|
||
|
||
def sre_command(ack, command, logger, respond, client, body): | ||
ack() | ||
|
@@ -47,8 +49,12 @@ def sre_command(ack, command, logger, respond, client, body): | |
webhook_helper.handle_webhook_command(args, client, body, respond) | ||
case "version": | ||
respond(f"SRE Bot version: {os.environ.get('GIT_SHA', 'unknown')}") | ||
case "google-service": | ||
google_service.google_service_command(client, body) | ||
case "google": | ||
if PREFIX == "dev-": | ||
google_service.google_service_command(client, body, respond) | ||
else: | ||
respond("This command is only available in the dev environment.") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like that you added this here! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I figured I should setup a toggle instead of just leaving it hanging in there in prod 😅 |
||
return | ||
case _: | ||
respond( | ||
f"Unknown command: `{action}`. Type `/sre help` to see a list of commands. \nCommande inconnue: `{action}`. Entrez `/sre help` pour une liste des commandes valides" | ||
|
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,4 @@ | ||
"""Google Docs module. | ||
|
||
This module provides functions to create and manipulate Google Docs. | ||
""" |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Super nitpicky, but I would put some spacing between the end of the first function and the def googe_service_command
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 think this is showing without space due to the way GitHub displays the changes inline 🤔
It shows like this in VSCode: