alita-sdk 0.3.226__py3-none-any.whl → 0.3.227__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -23,7 +23,7 @@ class BitbucketAPIWrapper(BaseCodeToolApiWrapper):
23
23
  """Wrapper for Bitbucket API."""
24
24
 
25
25
  _bitbucket: Any = PrivateAttr()
26
- active_branch: Any = PrivateAttr()
26
+ _active_branch: Any = PrivateAttr()
27
27
  url: str = ''
28
28
  project: str = ''
29
29
  """The key of the project this repo belongs to"""
@@ -78,12 +78,12 @@ class BitbucketAPIWrapper(BaseCodeToolApiWrapper):
78
78
  project=values['project'],
79
79
  repository=values['repository']
80
80
  )
81
- cls.active_branch = values.get('branch')
81
+ cls._active_branch = values.get('branch')
82
82
  return values
83
83
 
84
84
  def set_active_branch(self, branch: str) -> None:
85
85
  """Set the active branch for the bot."""
86
- self.active_branch = branch
86
+ self._active_branch = branch
87
87
  return f"Active branch set to `{branch}`"
88
88
 
89
89
  def list_branches_in_repo(self) -> List[str]:
@@ -93,15 +93,15 @@ class BitbucketAPIWrapper(BaseCodeToolApiWrapper):
93
93
  def create_branch(self, branch_name: str) -> None:
94
94
  """Create a new branch in the repository."""
95
95
  try:
96
- self._bitbucket.create_branch(branch_name, self.active_branch)
96
+ self._bitbucket.create_branch(branch_name, self._active_branch)
97
97
  except Exception as e:
98
98
  if "not permitted to access this resource" in str(e):
99
99
  return f"Please, verify you token/password: {str}"
100
100
  if "already exists" in str(e):
101
- self.active_branch = branch_name
101
+ self._active_branch = branch_name
102
102
  return f"Branch {branch_name} already exists. set it as active"
103
103
  return f"Unable to create branch due to error:\n{e}"
104
- self.active_branch = branch_name
104
+ self._active_branch = branch_name
105
105
  return f"Branch {branch_name} created successfully and set as active"
106
106
 
107
107
  def create_pull_request(self, pr_json_data: str) -> str:
@@ -161,7 +161,7 @@ class BitbucketAPIWrapper(BaseCodeToolApiWrapper):
161
161
  return result if isinstance(result, ToolException) else f"File has been updated: {file_path}."
162
162
  except Exception as e:
163
163
  return ToolException(f"File was not updated due to error: {str(e)}")
164
-
164
+
165
165
  def get_pull_requests_commits(self, pr_id: str) -> List[Dict[str, Any]]:
166
166
  """
167
167
  Get commits from a pull request
@@ -175,7 +175,7 @@ class BitbucketAPIWrapper(BaseCodeToolApiWrapper):
175
175
  return result
176
176
  except Exception as e:
177
177
  return ToolException(f"Can't get commits from pull request `{pr_id}` due to error:\n{str(e)}")
178
-
178
+
179
179
  def get_pull_requests(self) -> List[Dict[str, Any]]:
180
180
  """
181
181
  Get pull requests from the repository
@@ -183,7 +183,7 @@ class BitbucketAPIWrapper(BaseCodeToolApiWrapper):
183
183
  List[Dict[str, Any]]: List of pull requests in the repository
184
184
  """
185
185
  return self._bitbucket.get_pull_requests()
186
-
186
+
187
187
  def get_pull_request(self, pr_id: str) -> Dict[str, Any]:
188
188
  """
189
189
  Get details of a pull request
@@ -196,7 +196,7 @@ class BitbucketAPIWrapper(BaseCodeToolApiWrapper):
196
196
  return self._bitbucket.get_pull_request(pr_id=pr_id)
197
197
  except Exception as e:
198
198
  return ToolException(f"Can't get pull request `{pr_id}` due to error:\n{str(e)}")
199
-
199
+
200
200
  def get_pull_requests_changes(self, pr_id: str) -> Dict[str, Any]:
201
201
  """
202
202
  Get changes of a pull request
@@ -209,7 +209,7 @@ class BitbucketAPIWrapper(BaseCodeToolApiWrapper):
209
209
  return self._bitbucket.get_pull_requests_changes(pr_id=pr_id)
210
210
  except Exception as e:
211
211
  return ToolException(f"Can't get changes from pull request `{pr_id}` due to error:\n{str(e)}")
212
-
212
+
213
213
  def add_pull_request_comment(self, pr_id: str, content, inline=None) -> str:
214
214
  """
215
215
  Add a comment to a pull request. Supports multiple content types and inline comments.
@@ -234,7 +234,7 @@ class BitbucketAPIWrapper(BaseCodeToolApiWrapper):
234
234
  Returns:
235
235
  str: List of the files
236
236
  """
237
- return str(self._bitbucket.get_files_list(file_path=path if path else '', branch=branch if branch else self.active_branch))
237
+ return str(self._bitbucket.get_files_list(file_path=path if path else '', branch=branch if branch else self._active_branch))
238
238
 
239
239
  # TODO: review this method, it may not work as expected
240
240
  # def _file_commit_hash(self, file_path: str, branch: str):
@@ -555,7 +555,7 @@ class BaseCodeToolApiWrapper(BaseVectorStoreToolApiWrapper):
555
555
  """
556
556
  from .chunkers.code.codeparser import parse_code_files_for_db
557
557
 
558
- _files = self.__handle_get_files("", branch or self.active_branch)
558
+ _files = self.__handle_get_files("", branch or self.active_branch or self._active_branch)
559
559
 
560
560
  logger.info(f"Files in branch: {_files}")
561
561
 
@@ -573,8 +573,8 @@ class BaseCodeToolApiWrapper(BaseVectorStoreToolApiWrapper):
573
573
  for file in _files:
574
574
  if is_whitelisted(file) and not is_blacklisted(file):
575
575
  yield {"file_name": file,
576
- "file_content": self._read_file(file, branch=branch or self.active_branch),
577
- "commit_hash": self._file_commit_hash(file, branch=branch or self.active_branch)}
576
+ "file_content": self._read_file(file, branch=branch or self.active_branch or self._active_branch),
577
+ "commit_hash": self._file_commit_hash(file, branch=branch or self.active_branch or self._active_branch)}
578
578
 
579
579
  return parse_code_files_for_db(file_content_generator())
580
580
 
@@ -104,7 +104,7 @@ class GitLabAPIWrapper(BaseCodeToolApiWrapper):
104
104
  branch: Optional[str] = 'main'
105
105
  _git: Any = PrivateAttr()
106
106
  _repo_instance: Any = PrivateAttr()
107
- active_branch: Any = PrivateAttr()
107
+ _active_branch: Any = PrivateAttr()
108
108
 
109
109
  llm: Optional[Any] = None
110
110
  # Alita instance
@@ -138,11 +138,11 @@ class GitLabAPIWrapper(BaseCodeToolApiWrapper):
138
138
  g.auth()
139
139
  cls._repo_instance = g.projects.get(values.get('repository'))
140
140
  cls._git = g
141
- cls.active_branch = values.get('branch')
141
+ cls._active_branch = values.get('branch')
142
142
  return values
143
143
 
144
144
  def set_active_branch(self, branch_name: str) -> str:
145
- self.active_branch = branch_name
145
+ self._active_branch = branch_name
146
146
  self._repo_instance.default_branch = branch_name
147
147
  return f"Active branch set to {branch_name}"
148
148
 
@@ -172,19 +172,19 @@ class GitLabAPIWrapper(BaseCodeToolApiWrapper):
172
172
  return f"Failed to list branches: {str(e)}"
173
173
 
174
174
  def list_files(self, path: str = None, recursive: bool = True, branch: str = None) -> List[str]:
175
- branch = branch if branch else self.active_branch
175
+ branch = branch if branch else self._active_branch
176
176
  files = self._get_all_files(path, recursive, branch)
177
177
  paths = [file['path'] for file in files if file['type'] == 'blob']
178
178
  return paths
179
179
 
180
180
  def list_folders(self, path: str = None, recursive: bool = True, branch: str = None) -> List[str]:
181
- branch = branch if branch else self.active_branch
181
+ branch = branch if branch else self._active_branch
182
182
  files = self._get_all_files(path, recursive, branch)
183
183
  paths = [file['path'] for file in files if file['type'] == 'tree']
184
184
  return paths
185
185
 
186
186
  def _get_all_files(self, path: str = None, recursive: bool = True, branch: str = None):
187
- branch = branch if branch else self.active_branch
187
+ branch = branch if branch else self._active_branch
188
188
  return self._repo_instance.repository_tree(path=path, ref=branch, recursive=recursive, all=True)
189
189
 
190
190
  # overrided for indexer
@@ -210,15 +210,15 @@ class GitLabAPIWrapper(BaseCodeToolApiWrapper):
210
210
  self._repo_instance.branches.create(
211
211
  {
212
212
  'branch': branch_name,
213
- 'ref': self.active_branch,
213
+ 'ref': self._active_branch,
214
214
  }
215
215
  )
216
216
  except Exception as e:
217
217
  if "Branch already exists" in str(e):
218
- self.active_branch = branch_name
218
+ self._active_branch = branch_name
219
219
  return f"Branch {branch_name} already exists. set it as active"
220
220
  return f"Unable to create branch due to error:\n{e}"
221
- self.active_branch = branch_name
221
+ self._active_branch = branch_name
222
222
  return f"Branch {branch_name} created successfully and set as active"
223
223
 
224
224
  def parse_issues(self, issues: List[Any]) -> List[dict]:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: alita_sdk
3
- Version: 0.3.226
3
+ Version: 0.3.227
4
4
  Summary: SDK for building langchain agents using resources from Alita
5
5
  Author-email: Artem Rozumenko <artyom.rozumenko@gmail.com>, Mikalai Biazruchka <mikalai_biazruchka@epam.com>, Roman Mitusov <roman_mitusov@epam.com>, Ivan Krakhmaliuk <lifedjik@gmail.com>, Artem Dubrovskiy <ad13box@gmail.com>
6
6
  License-Expression: Apache-2.0
@@ -94,7 +94,7 @@ alita_sdk/runtime/utils/toolkit_runtime.py,sha256=MU63Fpxj0b5_r1IUUc0Q3-PN9VwL7r
94
94
  alita_sdk/runtime/utils/toolkit_utils.py,sha256=I9QFqnaqfVgN26LUr6s3XlBlG6y0CoHURnCzG7XcwVs,5311
95
95
  alita_sdk/runtime/utils/utils.py,sha256=CpEl3LCeLbhzQySz08lkKPm7Auac6IiLF7WB8wmArMI,589
96
96
  alita_sdk/tools/__init__.py,sha256=1AHqP2xyLjn92xVm70l9XIke6FkfHkLo5OoQVe4BuP8,10421
97
- alita_sdk/tools/elitea_base.py,sha256=anEPuN9dtOsSTJQlHpap5ho_hf-iPmBQpw4tmNUTP5k,30475
97
+ alita_sdk/tools/elitea_base.py,sha256=AmOks-hZfHFI2G0_fBh7Yyz3wjohyTA1sLxLEqW87EQ,30544
98
98
  alita_sdk/tools/ado/__init__.py,sha256=2NMQwt2pjIukSC9nSZ7CLocdGpK7002x7ixKr_wunxk,1313
99
99
  alita_sdk/tools/ado/utils.py,sha256=PTCludvaQmPLakF2EbCGy66Mro4-rjDtavVP-xcB2Wc,1252
100
100
  alita_sdk/tools/ado/repos/__init__.py,sha256=VvOapCG5okdyfCNdeTfOdcgRvl54cB1-sx_BF0TBWOw,6858
@@ -118,7 +118,7 @@ alita_sdk/tools/azure_ai/search/api_wrapper.py,sha256=E4p6HPDlwgxfT_i6cvg9rN4Vn_
118
118
  alita_sdk/tools/base/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
119
119
  alita_sdk/tools/base/tool.py,sha256=-N27AodZS49vdPCgFkU-bFS9bxoPopZBnNrmwInx3d0,864
120
120
  alita_sdk/tools/bitbucket/__init__.py,sha256=EEJUp965OT0JijI6x7U7DP-_5sgRC3Q3TbNnxky6hPo,5458
121
- alita_sdk/tools/bitbucket/api_wrapper.py,sha256=Sww4j67Ib5owH5-bKcSadikIQ9BJpzQXMVToku3Wpc0,10872
121
+ alita_sdk/tools/bitbucket/api_wrapper.py,sha256=OU55KjtFalYIZ4ioeBck0zjqTewB6BdwQuAS3Kud4R0,10847
122
122
  alita_sdk/tools/bitbucket/bitbucket_constants.py,sha256=UsbhQ1iEvrKoxceTFPWTYhaXS1zSxbmjs1TwY0-P4gw,462
123
123
  alita_sdk/tools/bitbucket/cloud_api_wrapper.py,sha256=VELi65tLXvszwCGQSqVfyVal0ylx9DgAmAGpRQL_Zkg,15522
124
124
  alita_sdk/tools/bitbucket/tools.py,sha256=zKBUq7t9zLa1EvhlVZzyVcZSvwvdcbtz0oslgPFZeeo,15307
@@ -203,7 +203,7 @@ alita_sdk/tools/github/schemas.py,sha256=yFsqivfjCPRk9GxFJrL8sTz6nnjFCZ0j5DIfPtG
203
203
  alita_sdk/tools/github/tool.py,sha256=Jnnv5lenV5ds8AAdyo2m8hSzyJ117HZBjzHC6T1ck-M,1037
204
204
  alita_sdk/tools/github/tool_prompts.py,sha256=y6ZW_FpUCE87Uop3WuQAZVRnzxO5t7xjBOI5bCqiluw,30194
205
205
  alita_sdk/tools/gitlab/__init__.py,sha256=DftTt4uVaRG4g2RFvLKyghG_A28ukGPHK9G2jojEGnM,4853
206
- alita_sdk/tools/gitlab/api_wrapper.py,sha256=SG8YL92ksTqM-lHgJL3XyycbvMb-DDkaCqdh0iwaY1Y,22292
206
+ alita_sdk/tools/gitlab/api_wrapper.py,sha256=KYCRO2pF8EPTLhWuEj64XsHPCYSucsf8S3R_ofJttrA,22301
207
207
  alita_sdk/tools/gitlab/tools.py,sha256=vOGTlSaGaFmWn6LS6YFP-FuTqUPun9vnv1VrUcUHAZQ,16500
208
208
  alita_sdk/tools/gitlab/utils.py,sha256=Z2XiqIg54ouqqt1to-geFybmkCb1I6bpE91wfnINH1I,2320
209
209
  alita_sdk/tools/gitlab_org/__init__.py,sha256=_DJ5y92E6GuNBtCuaEZakGNInxbuFtvLYZMTMCDf3Js,3713
@@ -307,8 +307,8 @@ alita_sdk/tools/zephyr_scale/api_wrapper.py,sha256=JAeWf-RXohsxheUpT0iMDClc_izj-
307
307
  alita_sdk/tools/zephyr_squad/__init__.py,sha256=0AI_j27xVO5Gk5HQMFrqPTd4uvuVTpiZUicBrdfEpKg,2796
308
308
  alita_sdk/tools/zephyr_squad/api_wrapper.py,sha256=kmw_xol8YIYFplBLWTqP_VKPRhL_1ItDD0_vXTe_UuI,14906
309
309
  alita_sdk/tools/zephyr_squad/zephyr_squad_cloud_client.py,sha256=R371waHsms4sllHCbijKYs90C-9Yu0sSR3N4SUfQOgU,5066
310
- alita_sdk-0.3.226.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
311
- alita_sdk-0.3.226.dist-info/METADATA,sha256=mbKuIG_1KR0BDC7Q8-c34XlXzugfo5k1Z2L7duhJebs,18917
312
- alita_sdk-0.3.226.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
313
- alita_sdk-0.3.226.dist-info/top_level.txt,sha256=0vJYy5p_jK6AwVb1aqXr7Kgqgk3WDtQ6t5C-XI9zkmg,10
314
- alita_sdk-0.3.226.dist-info/RECORD,,
310
+ alita_sdk-0.3.227.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
311
+ alita_sdk-0.3.227.dist-info/METADATA,sha256=Rdq53_hxX1XkPsuzWiYs9_74Sxo6BzniJu9PvooRS9A,18917
312
+ alita_sdk-0.3.227.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
313
+ alita_sdk-0.3.227.dist-info/top_level.txt,sha256=0vJYy5p_jK6AwVb1aqXr7Kgqgk3WDtQ6t5C-XI9zkmg,10
314
+ alita_sdk-0.3.227.dist-info/RECORD,,