mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Fix pylint warning
This commit is contained in:
parent
7bfec3ba70
commit
e99e93ff5b
@ -48,7 +48,7 @@ def query_api(url: str, params: Mapping[str, str], debug_requests=False) -> dict
|
|||||||
if len(params) > 0:
|
if len(params) > 0:
|
||||||
print(f'QUERY: {params}')
|
print(f'QUERY: {params}')
|
||||||
|
|
||||||
response = requests.get(url, params=params)
|
response = requests.get(url, params=params, timeout=60)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
|
|
||||||
if debug_requests:
|
if debug_requests:
|
||||||
@ -67,7 +67,7 @@ def download_file(url: str, target_path: Path, overwrite=False):
|
|||||||
if not overwrite and target_path.exists():
|
if not overwrite and target_path.exists():
|
||||||
raise FileAlreadyExists(f"Refusing to overwrite existing file: '{target_path}'.")
|
raise FileAlreadyExists(f"Refusing to overwrite existing file: '{target_path}'.")
|
||||||
|
|
||||||
with requests.get(url, stream=True) as request:
|
with requests.get(url, stream=True, timeout=60) as request:
|
||||||
with open(target_path, 'wb') as target_file:
|
with open(target_path, 'wb') as target_file:
|
||||||
shutil.copyfileobj(request.raw, target_file)
|
shutil.copyfileobj(request.raw, target_file)
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ def _git_run_command_mock(command):
|
|||||||
"If you have updated the code, please remember to add matching command fixtures above."
|
"If you have updated the code, please remember to add matching command fixtures above."
|
||||||
)
|
)
|
||||||
|
|
||||||
def _requests_get_mock(url, params):
|
def _requests_get_mock(url, params, timeout):
|
||||||
response_mock = Mock()
|
response_mock = Mock()
|
||||||
|
|
||||||
if url == 'https://api.github.com/repos/ethereum/solidity/pulls/12818':
|
if url == 'https://api.github.com/repos/ethereum/solidity/pulls/12818':
|
||||||
@ -174,6 +174,7 @@ def _requests_get_mock(url, params):
|
|||||||
"The test tried to perform an unexpected GET request.\n"
|
"The test tried to perform an unexpected GET request.\n"
|
||||||
f"URL: {url}\n" +
|
f"URL: {url}\n" +
|
||||||
(f"query: {params}\n" if len(params) > 0 else "") +
|
(f"query: {params}\n" if len(params) > 0 else "") +
|
||||||
|
f"timeout: {timeout}\n" +
|
||||||
"If you have updated the code, please remember to add matching response fixtures above."
|
"If you have updated the code, please remember to add matching response fixtures above."
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user