Skip to content

Commit 267330e

Browse files
committed
style: fix linting issues
- Remove trailing whitespace - Fix import ordering per ruff configuration - Apply code formatting per ruff-format rules - Fix line length violations and other style issues
1 parent 4d20eea commit 267330e

File tree

6 files changed

+197
-185
lines changed

6 files changed

+197
-185
lines changed

src/mcp_atlassian/jira/fields.py

Lines changed: 38 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66
from thefuzz import fuzz
77

88
from mcp_atlassian.models.jira.field_option import (
9+
JiraFieldContextOptionsResponse,
910
JiraFieldContextsResponse,
1011
JiraFieldOptionsResponse,
11-
JiraFieldContextOptionsResponse,
1212
)
13+
1314
from .client import JiraClient
1415
from .protocols import EpicOperationsProto, UsersOperationsProto
1516

@@ -554,11 +555,13 @@ def get_field_contexts(
554555
raise ValueError("Field ID is required")
555556

556557
if not field_id.startswith("customfield_"):
557-
raise ValueError("Field ID must be a custom field (starting with 'customfield_')")
558+
raise ValueError(
559+
"Field ID must be a custom field (starting with 'customfield_')"
560+
)
558561

559562
try:
560563
logger.debug(f"Getting contexts for field '{field_id}'")
561-
564+
562565
# Use different API endpoints for Cloud vs DC/Server
563566
if self.config.is_cloud:
564567
# Cloud API
@@ -567,7 +570,7 @@ def get_field_contexts(
567570
# DC/Server API - contexts endpoint may not exist or be different
568571
# For DC, we'll use the same endpoint as Cloud but with API v2
569572
path = f"/rest/api/2/field/{field_id}/context"
570-
573+
571574
params = {
572575
"startAt": start_at,
573576
"maxResults": max_results,
@@ -579,14 +582,15 @@ def get_field_contexts(
579582
)
580583

581584
if not isinstance(result, dict):
582-
error_msg = f"Unexpected response type from field contexts API: {type(result)}"
585+
error_msg = (
586+
f"Unexpected response type from field contexts API: {type(result)}"
587+
)
583588
logger.error(error_msg)
584589
raise ValueError(error_msg)
585590

586591
# Parse the response using our model
587592
contexts_response = JiraFieldContextsResponse.from_api_response(
588-
result,
589-
max_results=max_results
593+
result, max_results=max_results
590594
)
591595
logger.debug(
592596
f"Retrieved {len(contexts_response.values)} contexts for field '{field_id}'"
@@ -621,11 +625,13 @@ def get_field_options(
621625
raise ValueError("Field ID is required")
622626

623627
if not field_id.startswith("customfield_"):
624-
raise ValueError("Field ID must be a custom field (starting with 'customfield_')")
628+
raise ValueError(
629+
"Field ID must be a custom field (starting with 'customfield_')"
630+
)
625631

626632
try:
627633
logger.debug(f"Getting global options for field '{field_id}'")
628-
634+
629635
# Use different API endpoints for Cloud vs DC/Server
630636
if self.config.is_cloud:
631637
# Cloud API - different endpoint structure
@@ -635,7 +641,7 @@ def get_field_options(
635641
# Extract numerical ID from customfield_XXXXX
636642
numerical_id = field_id.replace("customfield_", "")
637643
path = f"/rest/api/2/customFields/{numerical_id}/options"
638-
644+
639645
params = {
640646
"startAt": start_at,
641647
"maxResults": max_results,
@@ -647,14 +653,15 @@ def get_field_options(
647653
)
648654

649655
if not isinstance(result, dict):
650-
error_msg = f"Unexpected response type from field options API: {type(result)}"
656+
error_msg = (
657+
f"Unexpected response type from field options API: {type(result)}"
658+
)
651659
logger.error(error_msg)
652660
raise ValueError(error_msg)
653661

654662
# Parse the response using our model
655663
options_response = JiraFieldOptionsResponse.from_api_response(
656-
result,
657-
max_results=max_results
664+
result, max_results=max_results
658665
)
659666
logger.debug(
660667
f"Retrieved {len(options_response.values)} options for field '{field_id}'"
@@ -694,11 +701,15 @@ def get_field_context_options(
694701
raise ValueError("Context ID is required")
695702

696703
if not field_id.startswith("customfield_"):
697-
raise ValueError("Field ID must be a custom field (starting with 'customfield_')")
704+
raise ValueError(
705+
"Field ID must be a custom field (starting with 'customfield_')"
706+
)
698707

699708
try:
700-
logger.debug(f"Getting context options for field '{field_id}' in context '{context_id}'")
701-
709+
logger.debug(
710+
f"Getting context options for field '{field_id}' in context '{context_id}'"
711+
)
712+
702713
# Use different API endpoints for Cloud vs DC/Server
703714
if self.config.is_cloud:
704715
# Cloud API
@@ -709,8 +720,10 @@ def get_field_context_options(
709720
# Extract numerical ID from customfield_XXXXX
710721
numerical_id = field_id.replace("customfield_", "")
711722
path = f"/rest/api/2/customFields/{numerical_id}/options"
712-
logger.warning(f"DC/Server may not support context-specific options for field '{field_id}', using general options")
713-
723+
logger.warning(
724+
f"DC/Server may not support context-specific options for field '{field_id}', using general options"
725+
)
726+
714727
params = {
715728
"startAt": start_at,
716729
"maxResults": max_results,
@@ -727,15 +740,18 @@ def get_field_context_options(
727740
raise ValueError(error_msg)
728741

729742
# Parse the response using our model
730-
context_options_response = JiraFieldContextOptionsResponse.from_api_response(
731-
result,
732-
max_results=max_results
743+
context_options_response = (
744+
JiraFieldContextOptionsResponse.from_api_response(
745+
result, max_results=max_results
746+
)
733747
)
734748
logger.debug(
735749
f"Retrieved {len(context_options_response.values)} options for field '{field_id}' in context '{context_id}'"
736750
)
737751
return context_options_response
738752

739753
except Exception as e:
740-
logger.error(f"Error getting context options for field '{field_id}' in context '{context_id}': {str(e)}")
754+
logger.error(
755+
f"Error getting context options for field '{field_id}' in context '{context_id}': {str(e)}"
756+
)
741757
raise

src/mcp_atlassian/models/jira/__init__.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@
1717
JiraTimetracking,
1818
JiraUser,
1919
)
20+
from .field_option import (
21+
JiraFieldContext,
22+
JiraFieldContextOptionsResponse,
23+
JiraFieldContextsResponse,
24+
JiraFieldOption,
25+
JiraFieldOptionsResponse,
26+
)
2027
from .issue import JiraIssue
2128
from .link import (
2229
JiraIssueLink,
@@ -25,13 +32,6 @@
2532
JiraLinkedIssueFields,
2633
)
2734
from .project import JiraProject
28-
from .field_option import (
29-
JiraFieldOption,
30-
JiraFieldContext,
31-
JiraFieldOptionsResponse,
32-
JiraFieldContextOptionsResponse,
33-
JiraFieldContextsResponse,
34-
)
3535
from .search import JiraSearchResult
3636
from .workflow import JiraTransition
3737
from .worklog import JiraWorklog

0 commit comments

Comments
 (0)