Skip to content

Commit 8599fb0

Browse files
authored
Merge pull request #291 from chaoss/chore/deprecate
Add deprecation warnings to functions that should be deprecated
2 parents 6b0c8be + d1971e5 commit 8599fb0

5 files changed

Lines changed: 12 additions & 8 deletions

File tree

collectoss/application/db/lib.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from sqlalchemy.exc import OperationalError
1010
from psycopg2.errors import DeadlockDetected
1111
from typing import List, Any, Optional, Union
12+
from typing_extensions import deprecated
1213

1314
from collectoss.application.db.models import Config, Repo, Commit, WorkerOauth, Issue, PullRequest, PullRequestReview, ContributorsAlias,UnresolvedCommitEmail, Contributor, CollectionStatus, UserGroup, RepoGroup
1415
from collectoss.tasks.util.collection_state import CollectionState
@@ -18,7 +19,7 @@
1819

1920
logger = logging.getLogger("db_lib")
2021

21-
22+
@deprecated("This is a legacy method. Use AugurConfig.get_value instead")
2223
def get_value(section_name: str, setting_name: str) -> Optional[Any]:
2324
"""Get the value of a setting from the config.
2425

collectoss/tasks/git/util/facade_worker/facade_worker/repofetch.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
from collectoss.application.db.models.augur_operations import CollectionStatus
3737
from collectoss.application.db.util import execute_session_query, convert_orm_list_to_dict_list
3838
from collectoss.application.db.lib import execute_sql, get_repo_by_repo_git
39+
from typing_extensions import deprecated
3940

4041
class GitCloneError(Exception):
4142
pass
@@ -174,8 +175,7 @@ def git_repo_initialize(facade_helper, session, repo_git):
174175
facade_helper.log_activity('Info', f"Fetching new repos (complete)")
175176

176177

177-
# Deprecated functionality. No longer used
178-
# Should be re-purposed in start_tasks when tasks are being scheduled
178+
@deprecated("Deprecated functionality. No longer used. Should be re-purposed in start_tasks when tasks are being scheduled")
179179
def check_for_repo_updates(session, repo_git):
180180

181181
# Check the last time a repo was updated and if it has been longer than the
@@ -244,7 +244,7 @@ def check_for_repo_updates(session, repo_git):
244244

245245
# Deprecated. No longer used.
246246

247-
247+
@deprecated("This functionality is deprecated and won't work with present facade versions")
248248
def force_repo_updates(session, repo_git):
249249
raise NotImplementedError(
250250
"This functionality is deprecated and won't work with present facade versions")
@@ -263,7 +263,7 @@ def force_repo_updates(session, repo_git):
263263

264264
# Deprecated. No longer used.
265265

266-
266+
@deprecated("This functionality is deprecated and won't work with present facade versions")
267267
def force_repo_analysis(session, repo_git):
268268
raise NotImplementedError(
269269
"This functionality is deprecated and won't work with present facade versions")

collectoss/tasks/github/facade_github/contributor_interfaceable/contributor_interface.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# Debugger
99
from collectoss.tasks.github.util.github_paginator import GithubApiResult
1010
from collectoss.application.db.lib import get_repo_by_repo_id, bulk_insert_dicts, execute_sql, get_contributors_by_github_user_id
11-
11+
from typing_extensions import deprecated
1212

1313
##TODO: maybe have a TaskSession class that holds information about the database, logger, config, etc.
1414

@@ -27,7 +27,7 @@ def clean_dict(d):
2727
return {k: ("" if v is None else v) for k, v in d.items()}
2828

2929

30-
# deprecated in favor of GithubDataAcess.get_resource()
30+
@deprecated("Please use GithubDataAcess.get_resource() instead")
3131
def request_dict_from_endpoint(logger, session, url, timeout_wait=10):
3232
"""Hit the endpoint specified by the url and return the json that it returns if it returns a dict.
3333

collectoss/tasks/github/util/github_paginator.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77

88
from typing import Optional
99
from enum import Enum
10+
from typing_extensions import deprecated
1011

11-
12+
@deprecated("Deprecated. Use GithubDataAccess class instead")
1213
def hit_api(key_manager, url: str, logger: logging.Logger, timeout: float = 10, method: str = 'GET', follow_redirects=True) -> Optional[httpx.Response]:
1314
"""Ping the api and get the data back for the page.
1415

collectoss/tasks/github/util/github_random_key_auth.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
from collectoss.tasks.util.random_key_auth import RandomKeyAuth
44
from collectoss.tasks.github.util.github_api_key_handler import GithubApiKeyHandler
55
from sqlalchemy.orm import Session
6+
from typing_extensions import deprecated
67

8+
@deprecated("This class is deprecated. Use the KeyClient interface to the Keymanager process instead.")
79
class GithubRandomKeyAuth(RandomKeyAuth):
810
"""Defines a github specific RandomKeyAuth class so
911
github collections can have a class randomly selects an api key for each request

0 commit comments

Comments
 (0)