python: Reformat code with black 22.3.0
Related to T3922
This commit is contained in:
parent
00f1b99ad9
commit
d38e05cff7
37 changed files with 265 additions and 144 deletions
|
@ -67,7 +67,10 @@ class CGitLister(StatelessLister[Repositories]):
|
|||
|
||||
"""
|
||||
super().__init__(
|
||||
scheduler=scheduler, url=url, instance=instance, credentials=credentials,
|
||||
scheduler=scheduler,
|
||||
url=url,
|
||||
instance=instance,
|
||||
credentials=credentials,
|
||||
)
|
||||
|
||||
self.session = requests.Session()
|
||||
|
@ -85,8 +88,8 @@ class CGitLister(StatelessLister[Repositories]):
|
|||
|
||||
def get_pages(self) -> Iterator[Repositories]:
|
||||
"""Generate git 'project' URLs found on the current CGit server
|
||||
The last_update date is retrieved on the list of repo page to avoid
|
||||
to compute it on the repository details which only give a date per branch
|
||||
The last_update date is retrieved on the list of repo page to avoid
|
||||
to compute it on the repository details which only give a date per branch
|
||||
"""
|
||||
next_page: Optional[str] = self.url
|
||||
while next_page:
|
||||
|
@ -206,7 +209,9 @@ def _parse_last_updated_date(repository: Dict[str, Any]) -> Optional[datetime]:
|
|||
|
||||
if not parsed_date:
|
||||
logger.warning(
|
||||
"Could not parse %s last_updated date: %s", repository["url"], date,
|
||||
"Could not parse %s last_updated date: %s",
|
||||
repository["url"],
|
||||
date,
|
||||
)
|
||||
|
||||
return parsed_date
|
||||
|
|
|
@ -80,7 +80,11 @@ def test_lister_cgit_run_populates_last_update(requests_mock_datadir, swh_schedu
|
|||
|
||||
urls_without_date = [
|
||||
f"https://git.tizen.org/cgit/{suffix_url}"
|
||||
for suffix_url in ["All-Projects", "All-Users", "Lock-Projects",]
|
||||
for suffix_url in [
|
||||
"All-Projects",
|
||||
"All-Users",
|
||||
"Lock-Projects",
|
||||
]
|
||||
]
|
||||
|
||||
lister_cgit = CGitLister(swh_scheduler, url=url)
|
||||
|
@ -145,7 +149,9 @@ def test_lister_cgit_date_parsing(date_str, expected_date):
|
|||
|
||||
|
||||
requests_mock_datadir_missing_url = requests_mock_datadir_factory(
|
||||
ignore_urls=["https://git.tizen/cgit/adaptation/ap_samsung/audio-hal-e4x12",]
|
||||
ignore_urls=[
|
||||
"https://git.tizen/cgit/adaptation/ap_samsung/audio-hal-e4x12",
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
|
@ -208,10 +214,12 @@ def test_lister_cgit_from_configfile(swh_scheduler_config, mocker):
|
|||
def test_lister_cgit_with_base_git_url(
|
||||
url, base_git_url, expected_nb_origins, requests_mock_datadir, swh_scheduler
|
||||
):
|
||||
"""With base git url provided, listed urls should be the computed origin urls
|
||||
|
||||
"""
|
||||
lister_cgit = CGitLister(swh_scheduler, url=url, base_git_url=base_git_url,)
|
||||
"""With base git url provided, listed urls should be the computed origin urls"""
|
||||
lister_cgit = CGitLister(
|
||||
swh_scheduler,
|
||||
url=url,
|
||||
base_git_url=base_git_url,
|
||||
)
|
||||
|
||||
stats = lister_cgit.run()
|
||||
|
||||
|
|
|
@ -25,7 +25,8 @@ def test_cgit_lister_task(
|
|||
kwargs = dict(url="https://git.kernel.org/", instance="kernel", base_git_url=None)
|
||||
|
||||
res = swh_scheduler_celery_app.send_task(
|
||||
"swh.lister.cgit.tasks.CGitListerTask", kwargs=kwargs,
|
||||
"swh.lister.cgit.tasks.CGitListerTask",
|
||||
kwargs=kwargs,
|
||||
)
|
||||
assert res
|
||||
res.wait()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue