Skip to content

Commit 4fcf074

Browse files
committed
fix: resolve lint errors and undefined variables
1 parent 349bd0b commit 4fcf074

4 files changed

Lines changed: 11 additions & 10 deletions

File tree

augur/tasks/github/contributors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def retrieve_dict_data(url: str, key_auth, logger):
9797
time.sleep(100)
9898
continue
9999

100-
elif "You have triggered an abuse detection mechanism." in page_data['message']:
100+
elif "You have triggered an abuse detection mechanism." in page_data['message']: # pylint: disable=no-else-continue
101101
#self.update_rate_limit(response, temporarily_disable=True,platform=platform)
102102
continue
103103
else:

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,11 @@ def request_dict_from_endpoint(logger, session, url, timeout_wait=10):
7272
success = True
7373
break
7474

75-
elif type(response_data) == list:
75+
elif type(response_data) == list: # pylint: disable=no-else-break
7676
logger.warning("Wrong type returned, trying again...")
7777
logger.debug(f"Returned list: {response_data}")
7878

79-
elif type(response_data) == str:
79+
elif type(response_data) == str: # pylint: disable=no-else-break
8080
logger.warning(f"Warning! page_data was string: {response_data}")
8181
if "<!DOCTYPE html>" in response_data:
8282
logger.warning("HTML was returned, trying again...\n")

augur/tasks/github/util/gh_graphql_entities.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import traceback
99
from augur.tasks.github.util.github_paginator import GithubApiResult, process_dict_response
1010
from augur.tasks.github.util.github_api_url import get_github_api_base_url
11+
process_graphql_dict_response = process_dict_response
1112

1213
"""
1314
Should be designed on a per entity basis that has attributes that call
@@ -87,7 +88,7 @@ def request_graphql_dict(key_auth, logger, url,query,variables={},timeout_wait=1
8788

8889
try:
8990
response_data = result.json()
90-
except: # pylint: disable=bare-except
91+
except (json.JSONDecodeError, AttributeError):
9192
response_data = json.loads(json.dumps(result.text))
9293

9394
#self.logger.info(f"api return: {response_data}")
@@ -102,10 +103,10 @@ def request_graphql_dict(key_auth, logger, url,query,variables={},timeout_wait=1
102103

103104
success = True
104105
break
105-
elif type(response_data) == list:
106+
if type(response_data) == list:
106107
logger.warning("Wrong type returned, trying again...")
107108
logger.info(f"Returned list: {response_data}")
108-
elif type(response_data) == str:
109+
if type(response_data) == str:
109110
logger.info(
110111
f"Warning! page_data was string: {response_data}")
111112
if "<!DOCTYPE html>" in response_data:
@@ -117,15 +118,15 @@ def request_graphql_dict(key_auth, logger, url,query,variables={},timeout_wait=1
117118
# Sometimes raw text can be converted to a dict
118119
response_data = json.loads(response_data)
119120
logger.info(f"{response_data}")
120-
err = process_graphql_dict_response(logger,result,response_data)
121+
err = process_dict_response(logger, result, response_data)
121122

122123
#If we get an error message that's not None
123124
if err and err != GithubApiResult.SUCCESS:
124125
continue
125126

126127
success = True
127128
break
128-
except: # pylint: disable=bare-except
129+
except (json.JSONDecodeError, KeyError, TypeError):
129130
pass
130131
attempts += 1
131132

augur/tasks/github/util/github_api_key_handler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
import random
44

55
from typing import List
6-
from sqlalchemy.orm import Session
6+
from sqlalchemy.orm import Session # pylint: disable=unused-import
77

88
from augur.tasks.util.redis_list import RedisList
99
from augur.application.db.lib import get_value, get_worker_oauth_keys
1010
from augur.tasks.github.util.github_api_url import get_github_api_base_url
11-
from sqlalchemy import func
11+
from sqlalchemy import func # pylint: disable=unused-import
1212

1313

1414

0 commit comments

Comments
 (0)