@@ -234,26 +234,26 @@ def get_jira_client(issue, config):
234234 return client
235235
236236
237- def _matching_jira_issue_query (client , issue , config ):
237+ def _get_existing_jira_issue (client , issue , config ):
238238 """
239- API calls that find matching JIRA tickets if any are present .
239+ Get a jira issue by the linked remote issue .
240240
241241 :param jira.client.JIRA client: JIRA client
242242 :param sync2jira.intermediary.Issue issue: Issue object
243243 :param Dict config: Config dict
244- :returns: results: Returns a list of matching JIRA issues if any are found
245- :rtype: List
244+ :returns: Returns a list of matching JIRA issues if any are found
245+ :rtype: str or None
246246 """
247247
248248 # If there's an entry for the issue in our cache, fetch the issue key from it.
249249 if result := jira_cache .get (issue .url ):
250- issue_keys = [ result ]
250+ issue_keys = ( result ,)
251251 else :
252252 # Search for Jira issues with a "remote link" to the issue.url;
253- # if we find none, return an empty list .
253+ # if we find none, return None .
254254 results = execute_snowflake_query (issue )
255255 if not results :
256- return []
256+ return None
257257
258258 # From the results returned by Snowflake, make an iterable of the
259259 # issues' keys.
@@ -307,7 +307,7 @@ def _matching_jira_issue_query(client, issue, config):
307307
308308 # Cache the result for next time and return it.
309309 jira_cache [issue .url ] = results [0 ].key
310- return results
310+ return results [ 0 ]
311311
312312
313313def find_username (_issue , config ):
@@ -392,24 +392,6 @@ def _comment_matching(g_comments, j_comments):
392392 )
393393
394394
395- def _get_existing_jira_issue (client , issue , config ):
396- """
397- Get a jira issue by the linked remote issue. \
398- This is the new supported way of doing this.
399-
400- :param jira.client.JIRA client: JIRA client
401- :param sync2jira.intermediary.Issue issue: Issue object
402- :param Dict config: Config dict
403- :returns: Returns a list of matching JIRA issues if any are found
404- :rtype: List
405- """
406- results = _matching_jira_issue_query (client , issue , config )
407- if results :
408- return results [0 ]
409- else :
410- return None
411-
412-
413395def _get_existing_jira_issue_legacy (client , issue ):
414396 """
415397 This is our old way of matching issues: use the special url field.
@@ -702,7 +684,7 @@ def _create_jira_issue(client, issue, config):
702684 return None
703685
704686 downstream = client .create_issue (** kwargs )
705- jira_cache [issue .url ] = [ downstream .key ]
687+ jira_cache [issue .url ] = downstream .key
706688
707689 # Add values to the Epic link, QA, and EXD-Service fields if present
708690 if (
0 commit comments