Moved devops related code to a separate package.
This commit is contained in:
1
devops/__init__.py
Normal file
1
devops/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
# devops package
|
||||
@@ -4,15 +4,11 @@ import requests
|
||||
import urllib.parse
|
||||
from uuid import UUID
|
||||
import logging
|
||||
from sk.logger import log_entity_creation
|
||||
|
||||
DEVOPS_SCOPE = "https://app.vssps.visualstudio.com/.default"
|
||||
DEVOPS_API_VERSION = "7.1"
|
||||
|
||||
# Get logger. It should be configured by the main application.
|
||||
log = logging.getLogger(__name__)
|
||||
# log.setLevel(logging.DEBUG)
|
||||
# log.propagate = False
|
||||
|
||||
# Define a class decorator
|
||||
def auto_properties(mapping: dict[str,str]):
|
||||
@@ -83,7 +79,6 @@ class Organization():
|
||||
self._org_url = org_url.rstrip("/") + "/" # Ensure trailing slash
|
||||
self._token = token
|
||||
self._api_version = api_version
|
||||
log_entity_creation(log, Organization, self._org_url)
|
||||
|
||||
def get_path(self, path: str, params: dict = {}) -> requests.Response:
|
||||
return get_url(
|
||||
@@ -131,8 +126,6 @@ class Project():
|
||||
except ValueError:
|
||||
raise ValueError(f"Invalid project ID: {self._id}")
|
||||
|
||||
log_entity_creation(log, Project, self.id)
|
||||
|
||||
def get_auto_properties(self):
|
||||
r = get_url(
|
||||
URL=f"{self._org._org_url}_apis/projects/{self._id}",
|
||||
@@ -195,7 +188,6 @@ class Repository():
|
||||
|
||||
# set other properties if provided
|
||||
self.from_args(**kwargs) # type: ignore[attr-defined]
|
||||
log_entity_creation(log, Repository, self.id)
|
||||
|
||||
def get_auto_properties(self):
|
||||
id = self._id if hasattr(self, "_id") else self._name # type: ignore[attr-defined]
|
||||
@@ -245,7 +237,6 @@ class Item():
|
||||
self.from_args(**kwargs) # type: ignore[attr-defined]
|
||||
if "branch" in kwargs:
|
||||
self._branch = kwargs.get("branch")
|
||||
log_entity_creation(log, Item, self.path)
|
||||
|
||||
@property
|
||||
def branch(self):
|
||||
Reference in New Issue
Block a user