Skip to content

Commit

Permalink
Fix oppia#15567: Python Interpreter Migration from 3.7.10 to 3.8.12 (o…
Browse files Browse the repository at this point in the history
  • Loading branch information
ashish-patwal authored Oct 18, 2022
1 parent b7225e9 commit 58d1033
Show file tree
Hide file tree
Showing 212 changed files with 261 additions and 420 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/backend_associated_test_file_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.7'
python-version: '3.8.12'
architecture: 'x64'
- uses: ./.github/actions/merge
- name: Cache node modules
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/backend_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.7'
python-version: '3.8.12'
architecture: 'x64'
- name: Cache node modules
uses: actions/cache@v2
Expand Down Expand Up @@ -65,7 +65,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.7'
python-version: '3.8.12'
architecture: 'x64'
- name: Cache node modules
uses: actions/cache@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e_additional_editor_and_player.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.7'
python-version: '3.8.12'
architecture: 'x64'
- uses: ./.github/actions/merge
- name: Cache node modules
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e_coverage_and_typescript_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.7'
python-version: '3.8.12'
architecture: 'x64'
- uses: ./.github/actions/merge
- name: Cache node modules
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.7'
python-version: '3.8.12'
architecture: 'x64'
- uses: ./.github/actions/merge
- name: Cache node modules
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.7'
python-version: '3.8.12'
architecture: 'x64'
- uses: ./.github/actions/merge
- name: Cache node modules
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.7'
python-version: '3.8.12'
architecture: 'x64'
- uses: ./.github/actions/merge
- name: Cache node modules
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e_miscellaneous_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.7'
python-version: '3.8.12'
architecture: 'x64'
- uses: ./.github/actions/merge
- name: Cache node modules
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e_other_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.7'
python-version: '3.8.12'
architecture: 'x64'
- uses: ./.github/actions/merge
- name: Cache node modules
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e_topic_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.7'
python-version: '3.8.12'
architecture: 'x64'
- uses: ./.github/actions/merge
- name: Cache node modules
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.7'
python-version: '3.8.12'
architecture: 'x64'
- uses: ./.github/actions/merge
- name: Cache node modules
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e_user_features_and_library.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.7'
python-version: '3.8.12'
architecture: 'x64'
- uses: ./.github/actions/merge
- name: Cache node modules
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e_user_profile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.7'
python-version: '3.8.12'
architecture: 'x64'
- uses: ./.github/actions/merge
- name: Cache node modules
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/eslint_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.7'
python-version: '3.8.12'
architecture: 'x64'
- uses: ./.github/actions/merge
- name: Cache node modules
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/frontend_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
echo $GITHUB_WORKSPACE
- uses: actions/setup-python@v2
with:
python-version: '3.7'
python-version: '3.8.12'
architecture: 'x64'
- uses: ./.github/actions/merge
- name: Cache node modules
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lighthouse_accessibility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ jobs:
shard: [1, 2]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
- uses: actions/setup-python@v2
with:
python-version: '3.7'
python-version: '3.8.12'
architecture: 'x64'
- uses: ./.github/actions/merge
# Caching is disabled to avoid poisoning our cache with the
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lighthouse_performance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ jobs:
shard: [1, 2]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
- uses: actions/setup-python@v2
with:
python-version: '3.7'
python-version: '3.8.12'
architecture: 'x64'
- uses: ./.github/actions/merge
- name: Cache node modules
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.7'
python-version: '3.8.12'
architecture: 'x64'
- uses: ./.github/actions/merge
- name: Cache node modules
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pending-review-notification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.7'
python-version: '3.8.12'
architecture: 'x64'
- uses: DubeySandeep/pending-review-notification@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python_type_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.7'
python-version: '3.8.12'
architecture: 'x64'
- name: Install python 2 for GAE
run: |
Expand Down
2 changes: 2 additions & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ disable=abstract-method,
not-context-manager,
redefined-variable-type,
redundant-returns-doc,
# TODO(#12912): Python interpreter migration to 3.8.12 causing failing lint check. Fix it later.
redundant-u-string-prefix,
too-many-arguments,
too-many-boolean-expressions,
too-many-branches,
Expand Down
2 changes: 1 addition & 1 deletion app_dev.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
runtime: python37
runtime: python38
instance_class: F2
# The "version" line is added here so that MR jobs can run locally (see issue
# #6534 on oppia/oppia).
Expand Down
5 changes: 4 additions & 1 deletion core/controllers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,10 @@ def _create_token(cls, user_id, issued_on):
# Round time to seconds.
issued_on = str(int(issued_on))

digester = hmac.new(CSRF_SECRET.value.encode('utf-8'))
digester = hmac.new(
key=CSRF_SECRET.value.encode('utf-8'),
digestmod='md5'
)
digester.update(user_id.encode('utf-8'))
digester.update(b':')
digester.update(issued_on.encode('utf-8'))
Expand Down
3 changes: 1 addition & 2 deletions core/domain/activity_services_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
from core.domain import user_services
from core.tests import test_utils

from typing import List
from typing_extensions import Final
from typing import Final, List


class ActivityServicesTests(test_utils.GenericTestBase):
Expand Down
3 changes: 1 addition & 2 deletions core/domain/app_feedback_report_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
from core.domain import story_domain
from core.domain import topic_domain

from typing import Any, Dict, List, Match, Optional, Union
from typing_extensions import TypedDict
from typing import Any, Dict, List, Match, Optional, TypedDict, Union

# TODO(#14537): Refactor this file and remove imports marked
# with 'invalid-import-from'.
Expand Down
3 changes: 1 addition & 2 deletions core/domain/app_feedback_report_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
from core.domain import app_feedback_report_domain
from core.platform import models

from typing import Dict, List, Optional, Sequence, cast, overload
from typing_extensions import Literal
from typing import Dict, List, Literal, Optional, Sequence, cast, overload

MYPY = False
if MYPY: # pragma: no cover
Expand Down
3 changes: 1 addition & 2 deletions core/domain/auth_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@

from core import utils

from typing import Any, Optional
from typing_extensions import TypedDict
from typing import Any, Optional, TypedDict

# Auth ID refers to an identifier that links many Identity Providers to a single
# user. For example, an individual user's Facebook, Google, and Apple profiles
Expand Down
3 changes: 1 addition & 2 deletions core/domain/blog_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@
from core import utils
from core.constants import constants

from typing import List, Optional
from typing_extensions import TypedDict
from typing import List, Optional, TypedDict

from core.domain import html_cleaner # pylint: disable=invalid-import-from # isort:skip

Expand Down
4 changes: 2 additions & 2 deletions core/domain/blog_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
from core.domain import user_domain
from core.platform import models

from typing import Callable, List, Optional, Sequence, Tuple, overload
from typing_extensions import Literal, TypedDict
from typing import (
Callable, List, Literal, Optional, Sequence, Tuple, TypedDict, overload)

MYPY = False
if MYPY: # pragma: no cover
Expand Down
5 changes: 3 additions & 2 deletions core/domain/caching_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@
from core.domain import topic_domain
from core.platform import models

from typing import Callable, Dict, List, Mapping, Optional, Union, overload
from typing_extensions import Final, Literal, TypedDict
from typing import (
Callable, Dict, Final, List, Literal, Mapping, Optional, TypedDict,
Union, overload)

MYPY = False
if MYPY: # pragma: no cover
Expand Down
3 changes: 1 addition & 2 deletions core/domain/calculation_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@

from extensions.answer_summarizers import models

from typing import Callable, Dict, overload
from typing_extensions import Literal
from typing import Callable, Dict, Literal, overload


class Registry:
Expand Down
3 changes: 1 addition & 2 deletions core/domain/classifier_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
from core import utils
from core.domain import state_domain

from typing import Dict, List
from typing_extensions import TypedDict
from typing import Dict, List, TypedDict


class ClassifierTrainingJobDict(TypedDict):
Expand Down
3 changes: 1 addition & 2 deletions core/domain/classifier_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@
from core.domain import state_domain
from core.platform import models

from typing import Dict, List, Optional, Sequence
from typing_extensions import TypedDict
from typing import Dict, List, Optional, Sequence, TypedDict

MYPY = False
if MYPY: # pragma: no cover
Expand Down
3 changes: 1 addition & 2 deletions core/domain/classroom_config_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
from core import utils
from core.constants import constants

from typing import Dict, List
from typing_extensions import TypedDict
from typing import Dict, List, TypedDict


class ClassroomDict(TypedDict):
Expand Down
3 changes: 1 addition & 2 deletions core/domain/classroom_config_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
from core.domain import classroom_config_domain
from core.platform import models

from typing import Dict, List, Optional, overload
from typing_extensions import Literal
from typing import Dict, List, Literal, Optional, overload

MYPY = False
if MYPY: # pragma: no cover
Expand Down
3 changes: 1 addition & 2 deletions core/domain/collection_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@
from core.constants import constants
from core.domain import change_domain

from typing import Dict, List, Optional, cast
from typing_extensions import Final, Literal, TypedDict
from typing import Dict, Final, List, Literal, Optional, TypedDict, cast

# Do not modify the values of these constants. This is to preserve backwards
# compatibility with previous change dicts.
Expand Down
5 changes: 2 additions & 3 deletions core/domain/collection_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,8 @@
from core.platform import models

from typing import (
Dict, Iterable, List, Mapping, Optional, Sequence, Tuple, cast, overload
)
from typing_extensions import Final, Literal, TypedDict
Dict, Final, Iterable, List, Literal, Mapping, Optional, Sequence, Tuple,
TypedDict, cast, overload)

MYPY = False
if MYPY: # pragma: no cover
Expand Down
3 changes: 1 addition & 2 deletions core/domain/collection_services_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@
from core.platform import models
from core.tests import test_utils

from typing import Dict, List, Optional
from typing_extensions import Final
from typing import Dict, Final, List, Optional

MYPY = False
if MYPY: # pragma: no cover
Expand Down
3 changes: 1 addition & 2 deletions core/domain/config_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
from core.constants import constants
from core.domain import change_domain

from typing import Any, Dict, List, Optional, Sequence, Union
from typing_extensions import TypedDict
from typing import Any, Dict, List, Optional, Sequence, TypedDict, Union

from core.domain import caching_services # pylint: disable=invalid-import-from # isort:skip
from core.platform import models # pylint: disable=invalid-import-from # isort:skip
Expand Down
3 changes: 1 addition & 2 deletions core/domain/draft_upgrade_services_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
from core.domain import state_domain
from core.tests import test_utils

from typing import Dict
from typing_extensions import Final
from typing import Dict, Final


class DraftUpgradeUnitTests(test_utils.GenericTestBase):
Expand Down
Loading

0 comments on commit 58d1033

Please sign in to comment.