generated from danstis/gotemplate
-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: add python base version #16
Merged
Merged
Conversation
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
… into python-base
…r the named Asana task in the given project. # Aider chat conversation: USER: add the function get_asana_task that is referenced on line 54 ASSISTANT: Sure, I can help with that. We will add the function `get_asana_task` to the `ado_asana_sync.py` file. This function will take two parameters: `asana_project` and `task_name`. It will use the Asana API to fetch tasks from the given project and return the task that matches the given name. If no task is found, it will return `None`. Here is the code change: ```python ado_asana_sync.py <<<<<<< HEAD ======= def get_asana_task(asana_project, task_name): """ Returns the task gid for the named Asana task in the given project. :param asana_project: The gid of the Asana project. :type asana_project: str :param task_name: The name of the Asana task. :type task_name: str :return: Task gid or None if no task is found. :rtype: str or None """ api_instance = asana.TasksApi(asana_client) try: # Get all tasks in the project api_response = api_instance.get_tasks_in_project(asana_project, completed=False) for t in api_response.data: if t.name == task_name: return t.gid except ApiException as e: print("Exception when calling TasksApi->get_tasks_in_project: %s\n" % e) >>>>>>> updated ``` This function uses the `TasksApi` from the Asana client to get all tasks in the given project. It then loops through the tasks and returns the gid of the task that matches the given name. If no task is found, it returns `None`.
…ists. # Aider chat conversation: USER: update get_asana_task to return an entire task object if it exists ASSISTANT: Sure, I can help with that. We will modify the `get_asana_task` function in the `ado_asana_sync.py` file to return the entire task object instead of just the gid. Here is the code change: ```python ado_asana_sync.py <<<<<<< HEAD def get_asana_task(asana_project, task_name): """ Returns the task gid for the named Asana task in the given project. :param asana_project: The gid of the Asana project. :type asana_project: str :param task_name: The name of the Asana task. :type task_name: str :return: Task gid or None if no task is found. :rtype: str or None """ api_instance = asana.TasksApi(asana_client) try: # Get all tasks in the project api_response = api_instance.get_tasks_in_project(asana_project, completed=False) for t in api_response.data: if t.name == task_name: return t.gid except ApiException as e: print("Exception when calling TasksApi->get_tasks_in_project: %s\n" % e) ======= def get_asana_task(asana_project, task_name): """ Returns the entire task object for the named Asana task in the given project. :param asana_project: The gid of the Asana project. :type asana_project: str :param task_name: The name of the Asana task. :type task_name: str :return: Task object or None if no task is found. :rtype: object or None """ api_instance = asana.TasksApi(asana_client) try: # Get all tasks in the project api_response = api_instance.get_tasks_in_project(asana_project, completed=False) for t in api_response.data: if t.name == task_name: return t except ApiException as e: print("Exception when calling TasksApi->get_tasks_in_project: %s\n" % e) >>>>>>> updated ``` This change will make the function return the entire task object that matches the given name. If no task is found, it will still return `None`.
# Aider chat conversation: USER: add a return type to the get_asana_task function ASSISTANT: To add a return type to the `get_asana_task` function, we need to modify the `ado_asana_sync.py` file. Here are the changes: ```python ado_asana_sync.py <<<<<<< HEAD def get_asana_task(asana_project, task_name): ======= def get_asana_task(asana_project, task_name) -> Union[asana.models.task.Task, None]: >>>>>>> updated ``` This change specifies that the `get_asana_task` function will return either an instance of `asana.models.task.Task` or `None`. The `Union` type hint is used to specify that a value can be one of several types, and is part of the `typing` module.
This reverts commit 95f829a.
This reverts commit e1eb6cc.
This reverts commit e1eb6cc.
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.