Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix part of #14033: Added Mypy type annotations to some files. #14469

Merged
merged 53 commits into from
Jan 19, 2022
Merged
Changes from 1 commit
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
d74038b
Fixes part of #9749: Migrate few instances of angular-html-bind (#14263)
srijanreddy98 Nov 27, 2021
354d901
Merge remote-tracking branch 'upstream/develop' into develop
sahiljoster32 Nov 28, 2021
7930e4f
Merge remote-tracking branch 'upstream/develop' into develop
sahiljoster32 Dec 4, 2021
2ff1fcb
Merge remote-tracking branch 'upstream/develop' into develop
sahiljoster32 Dec 8, 2021
7da71af
Merge remote-tracking branch 'upstream/develop' into develop
sahiljoster32 Dec 9, 2021
6afee7e
Merge remote-tracking branch 'upstream/develop' into develop
sahiljoster32 Dec 11, 2021
f6a3c12
Merge remote-tracking branch 'upstream/develop' into develop
sahiljoster32 Dec 12, 2021
5dc96d8
pending with tests
sahiljoster32 Dec 18, 2021
bffe408
pending with caching_services
sahiljoster32 Dec 19, 2021
f65c8ba
lint 1
sahiljoster32 Dec 19, 2021
39fbb95
lint 2
sahiljoster32 Dec 19, 2021
c34365a
lint 3
sahiljoster32 Dec 19, 2021
7fec54c
pending with test
sahiljoster32 Dec 20, 2021
1885375
lint
sahiljoster32 Dec 20, 2021
9667b75
done
sahiljoster32 Dec 21, 2021
13f1b09
fixed models type
sahiljoster32 Dec 21, 2021
8a67ca0
nits
sahiljoster32 Dec 21, 2021
c4c2a94
removed conflicts
sahiljoster32 Dec 21, 2021
44a0126
added changes
sahiljoster32 Dec 21, 2021
d11cfaf
lint 1
sahiljoster32 Dec 21, 2021
62b2e5e
lint again :_(
sahiljoster32 Dec 21, 2021
9b7a5b5
added changes -1
sahiljoster32 Dec 23, 2021
fe36b85
changes -2
sahiljoster32 Dec 23, 2021
fd656c8
changes -3
sahiljoster32 Dec 28, 2021
28669b1
changes -4
sahiljoster32 Jan 4, 2022
94084f6
added changes -3
sahiljoster32 Jan 4, 2022
601d151
fixing backend tests
sahiljoster32 Jan 4, 2022
44e8825
added changes -4
sahiljoster32 Jan 4, 2022
2e91bd8
changes -5
sahiljoster32 Jan 6, 2022
c647552
added changes
sahiljoster32 Jan 8, 2022
20c8315
Merge remote-tracking branch 'upstream/develop' into mytypes
sahiljoster32 Jan 8, 2022
176807f
added literals
sahiljoster32 Jan 8, 2022
5252178
added overload decorator
sahiljoster32 Jan 9, 2022
6b6ead6
Merge remote-tracking branch 'upstream/develop' into mytypes
sahiljoster32 Jan 12, 2022
6a3f29b
added changes
sahiljoster32 Jan 13, 2022
1d19b94
added changes
sahiljoster32 Jan 14, 2022
4d29919
removed conflicts
sahiljoster32 Jan 14, 2022
a85bc4f
added changes -12
sahiljoster32 Jan 14, 2022
3d99ce3
added changes
sahiljoster32 Jan 15, 2022
53a8d9a
removed merge conflicts
sahiljoster32 Jan 15, 2022
e4017ee
lint
sahiljoster32 Jan 15, 2022
9537ed6
fixed backend test
sahiljoster32 Jan 15, 2022
b943be9
added changes
sahiljoster32 Jan 16, 2022
2f62fd9
lint
sahiljoster32 Jan 16, 2022
c71a403
added changes
sahiljoster32 Jan 16, 2022
d0a9978
test coverage
sahiljoster32 Jan 16, 2022
4ca7c69
test coverage -2
sahiljoster32 Jan 16, 2022
2840a8a
added overload
sahiljoster32 Jan 17, 2022
69cac5d
Update core/domain/caching_services.py
sahiljoster32 Jan 17, 2022
995563c
added changes
sahiljoster32 Jan 18, 2022
c0b4738
Merge branch 'develop' of https://github.com/oppia/oppia into mytypes
sahiljoster32 Jan 18, 2022
b299913
Merge remote-tracking branch 'origin/mytypes' into mytypes
sahiljoster32 Jan 18, 2022
085e97e
corrected comment
sahiljoster32 Jan 18, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
added changes
sahiljoster32 committed Jan 16, 2022
commit c71a4032c1a9f77954ba1a9bcbf262510a528a51
6 changes: 3 additions & 3 deletions core/domain/config_domain.py
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@
from core.constants import constants
from core.domain import change_domain

from typing import Any, Dict, List, cast
from typing import Any, Dict, List, Optional

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
@@ -359,7 +359,7 @@ def init_config_property(cls, name: str, instance: ConfigProperty) -> None:
cls._config_registry[name] = instance

@classmethod
def get_config_property(cls, name: str) -> ConfigProperty:
def get_config_property(cls, name: str) -> Optional[ConfigProperty]:
"""Returns the instance of the specified name of the configuration
property.

@@ -369,7 +369,7 @@ def get_config_property(cls, name: str) -> ConfigProperty:
Returns:
instance. The instance of the specified configuration property.
"""
return cast(ConfigProperty, cls._config_registry.get(name))
return cls._config_registry.get(name)

# This function returns Dict with property_name as key and every value
# is a Dict of properties of that particular property_name.
2 changes: 1 addition & 1 deletion core/domain/config_domain_test.py
Original file line number Diff line number Diff line change
@@ -97,7 +97,7 @@ class ConfigPropertyRegistryTests(test_utils.GenericTestBase):
def test_config_property_schemas_are_valid(self) -> None:
for property_name in (
config_domain.Registry.get_all_config_property_names()):
schema = config_domain.Registry.get_config_property(
schema = config_domain.Registry.get_config_property( # type: ignore[union-attr]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this ignore needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as we made get_config_property to return optional[configproperty], then mypy assumes returned value by get_config_property does not contain schema property.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then you can do

config_property = config_domain.Registry.get_config_property(property_name)
# Ruling out the possibility of None for mypy type checking.
assert config_property is not None
schema_utils_test.validate_schema(config_property.schema)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

property_name).schema
schema_utils_test.validate_schema(schema)