Ran pyupgrade on lms/djangoapps

Ran pyupgrade on lms/djangoapps/mailing
Ran pyupgrade on lms/djangoapps/mobile_api
Ran pyupgrade on lms/djangoapps/monitoring
This commit is contained in:
usamasadiq
2021-02-16 17:24:37 +05:00
parent ba16e05899
commit dc36d0bfe8
24 changed files with 102 additions and 122 deletions

View File

@@ -18,6 +18,7 @@ Or for more details::
"""
import csv
import click
@@ -54,7 +55,7 @@ def main(unmapped_csv):
Script removes duplicates in addition to providing sorted list of plain app names.
"""
with open(unmapped_csv, 'r') as file:
with open(unmapped_csv) as file:
csv_data = file.read()
reader = csv.DictReader(csv_data.splitlines())

View File

@@ -12,10 +12,11 @@ Or for more details::
"""
import csv
import click
import os
import re
import click
# Maps edx-platform installed Django apps to the edx repo that contains
# the app code.
EDX_REPO_APPS = {
@@ -113,10 +114,10 @@ def main(repo_csv, app_csv, dep_csv):
print('# Do not hand edit CODE_OWNER_MAPPINGS. Generated by {}'.format(os.path.basename(__file__)))
print('CODE_OWNER_MAPPINGS:')
for owner, path_list in sorted(owner_to_paths_map.items()):
print(" {}:".format(owner))
print(f" {owner}:")
path_list.sort()
for path in path_list:
print(" - {}".format(path))
print(f" - {path}")
owner_with_mappings_set = set(owner_to_paths_map.keys())
print('# Do not hand edit CODE_OWNER_THEMES. Generated by {}'.format(os.path.basename(__file__)))
@@ -126,10 +127,10 @@ def main(repo_csv, app_csv, dep_csv):
# only include the theme's list of owners that have mappings
theme_owner_with_mappings_list = list(theme_owner_set & owner_with_mappings_set)
if theme_owner_with_mappings_list:
print(" {}:".format(theme))
print(f" {theme}:")
theme_owner_with_mappings_list.sort()
for owner in theme_owner_with_mappings_list:
print(" - {}".format(owner))
print(f" - {owner}")
def _map_repo_apps(csv_type, repo_csv, app_to_repo_map, owner_map, owner_to_paths_map):
@@ -144,7 +145,7 @@ def _map_repo_apps(csv_type, repo_csv, app_to_repo_map, owner_map, owner_to_path
owner_to_paths_map (dict): Holds results mapping owner to paths
"""
with open(repo_csv, 'r') as file:
with open(repo_csv) as file:
csv_data = file.read()
reader = csv.DictReader(csv_data.splitlines())
@@ -160,14 +161,14 @@ def _map_repo_apps(csv_type, repo_csv, app_to_repo_map, owner_map, owner_to_path
owner_to_paths_map[owner] = []
owner_to_paths_map[owner].append(app)
else:
print('WARNING: Repo {} was not found in {} csv. Needed for app {}.'.format(repo_url, csv_type, app))
print(f'WARNING: Repo {repo_url} was not found in {csv_type} csv. Needed for app {app}.')
def _map_edx_platform_apps(app_csv, owner_map, owner_to_paths_map):
"""
Reads CSV of edx-platform app ownership and updates mappings
"""
with open(app_csv, 'r') as file:
with open(app_csv) as file:
csv_data = file.read()
reader = csv.DictReader(csv_data.splitlines())
for row in reader:
@@ -215,7 +216,7 @@ def _get_and_map_code_owner(row, owner_map):
if theme:
theme = theme.lower()
owner = '{}-{}'.format(theme, squad) if theme else squad
owner = f'{theme}-{squad}' if theme else squad
theme = theme or squad
if squad not in owner_map['squad_to_theme_map']: