Skip to content

Commit c280ef5

Browse files
committed
Fix regression
1 parent db0c7e3 commit c280ef5

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

sonar/branches.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
from sonar.util import cache
3434
import sonar.logging as log
3535
from sonar import components, settings, exceptions, tasks
36-
from sonar.projects import Project
36+
from sonar import projects as proj
3737
import sonar.utilities as util
3838

3939
from sonar.audit.problem import Problem
@@ -60,7 +60,7 @@ class Branch(components.Component):
6060
"get_new_code": "new_code_periods/list",
6161
}
6262

63-
def __init__(self, project: Project, name: str) -> None:
63+
def __init__(self, project: proj.Project, name: str) -> None:
6464
"""Don't use this, use class methods to create Branch objects
6565
6666
:raises UnsupportedOperation: When attempting to branches on Community Edition
@@ -79,7 +79,7 @@ def __init__(self, project: Project, name: str) -> None:
7979
log.debug("Created object %s", str(self))
8080

8181
@classmethod
82-
def get_object(cls, concerned_object: Project, branch_name: str) -> Branch:
82+
def get_object(cls, concerned_object: proj.Project, branch_name: str) -> Branch:
8383
"""Gets a SonarQube Branch object
8484
8585
:param Project concerned_object: Project concerned by the branch
@@ -100,7 +100,7 @@ def get_object(cls, concerned_object: Project, branch_name: str) -> Branch:
100100
return cls.load(concerned_object, branch_name, br)
101101

102102
@classmethod
103-
def load(cls, concerned_object: Project, branch_name: str, data: types.ApiPayload) -> Branch:
103+
def load(cls, concerned_object: proj.Project, branch_name: str, data: types.ApiPayload) -> Branch:
104104
"""Gets a Branch object from JSON data gotten from a list API call
105105
106106
:param Project concerned_object: the Project the branch belonsg to
@@ -125,7 +125,7 @@ def __hash__(self) -> int:
125125
"""Computes a uuid for the branch that can serve as index"""
126126
return hash((self.concerned_object.key, self.name, self.base_url()))
127127

128-
def project(self) -> Project:
128+
def project(self) -> proj.Project:
129129
"""Returns the project key"""
130130
return self.concerned_object
131131

@@ -189,7 +189,7 @@ def get(
189189
except exceptions.ObjectNotFound as e:
190190
if re.match(r"Project .+ not found", e.message):
191191
log.warning("Clearing project cache")
192-
Project.CACHE.clear()
192+
proj.Project.CACHE.clear()
193193
raise
194194

195195
def post(self, api: str, params: types.ApiParams = None, mute: tuple[HTTPStatus] = (), **kwargs: str) -> requests.Response:
@@ -199,7 +199,7 @@ def post(self, api: str, params: types.ApiParams = None, mute: tuple[HTTPStatus]
199199
except exceptions.ObjectNotFound as e:
200200
if re.match(r"Project .+ not found", e.message):
201201
log.warning("Clearing project cache")
202-
Project.CACHE.clear()
202+
proj.Project.CACHE.clear()
203203
raise
204204

205205
def new_code(self) -> str:
@@ -416,7 +416,7 @@ def last_task(self) -> Optional[tasks.Task]:
416416
return task
417417

418418

419-
def get_list(project: Project) -> dict[str, Branch]:
419+
def get_list(project: proj.Project) -> dict[str, Branch]:
420420
"""Retrieves the list of branches of a project
421421
422422
:param Project project: Project the branch belongs to
@@ -444,7 +444,7 @@ def exists(endpoint: platform.Platform, branch_name: str, project_key: str) -> b
444444
:rtype: bool
445445
"""
446446
try:
447-
project = Project.get_object(endpoint, project_key)
447+
project = proj.Project.get_object(endpoint, project_key)
448448
except exceptions.ObjectNotFound:
449449
return False
450450
return branch_name in get_list(project)

0 commit comments

Comments
 (0)