internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: oppia/oppia

Issue:
Add rule translation support for TextInput and SetInput interactions
Add rule translation support for TextInput and SetInput interactions. #11569 surfaces translations for customization args, but not rule inputs. 

After this is done, make sure ```INTERACTIONS_THAT_ARE_CURRENTLY_UNTRANSLATABLE``` in ```core/templates/domain/exploration/ExplorationObjectFactory.ts``` is empty.
Add rule translation support for TextInput and SetInput interactions
Add rule translation support for TextInput and SetInput interactions. #11569 surfaces translations for customization args, but not rule inputs. 

After this is done, make sure ```INTERACTIONS_THAT_ARE_CURRENTLY_UNTRANSLATABLE``` in ```core/templates/domain/exploration/ExplorationObjectFactory.ts``` is empty.


Discussion:

Resolving patch:
diff --git a/core/domain/state_domain.py b/core/domain/state_domain.py
--- a/core/domain/state_domain.py
+++ b/core/domain/state_domain.py
@@ -1426,7 +1426,14 @@ def validate(self):
 
 
 class WrittenTranslation(python_utils.OBJECT):
-    """Value object representing a written translation for a content."""
+    """Value object representing a written translation for a content.
+
+    Here, "content" could mean a string or a list of strings. The latter arises,
+    for example, in the case where we are checking for equality of a learner's
+    answer against a given set of strings. In such cases, the number of strings
+    in the translation of the original object may not be the same as the number
+    of strings in the original object.
+    """
 
     DATA_FORMAT_HTML = 'html'
     DATA_FORMAT_UNICODE_STRING = 'unicode'


Test patch:
diff --git a/core/domain/state_domain_test.py b/core/domain/state_domain_test.py
--- a/core/domain/state_domain_test.py
+++ b/core/domain/state_domain_test.py
@@ -4319,7 +4319,12 @@ def test_from_and_to_dict_works_correctly(self):
                         'data_format': 'html',
                         'translation': 'Hey!',
                         'needs_update': False
-                    }
+                    },
+                    'fr': {
+                        'data_format': 'set_of_normalized_string',
+                        'translation': ['test1', 'test2'],
+                        'needs_update': False
+                    },
                 },
                 'feedback_1': {
                     'hi': {
@@ -4331,6 +4336,11 @@ def test_from_and_to_dict_works_correctly(self):
                         'data_format': 'html',
                         'translation': 'hello!',
                         'needs_update': False
+                    },
+                    'fr': {
+                        'data_format': 'set_of_normalized_string',
+                        'translation': ['test1', 'test2'],
+                        'needs_update': False
                     }
                 }
             }
Repository: oppia/oppia

Issue:
Adding Brave Browser Support 
<!--
  - Thanks for taking the time to propose a new feature for the Oppia project.
  - Before filing a new issue, please do a quick search to check that it hasn't
  - already been filed on the [issue tracker](https://github.com/oppia/oppia/issues)._
  -->
**Is your feature request related to a problem? Please describe.**
Brave is a modern web browser based on the chromium web browser . This browser if fairly popular , and is used by many people in the community , as a better alternative to google-chrome or chromium browser . Addition of this browser , will certainly lessen the extra steps we need to run oppia on arch based systems .
**Describe the solution you'd like**
I would like to add brave as a supported browser for e2e testing and other stuff for arch based systems . Since it is a chromium based browser , it will fully support the oppia platform .
**Describe alternatives you've considered**
At the time , the alternatives are chromium browser and google-chrome , which are already present for oppia . 
**Additional context**
NA



Discussion:

Resolving patch:
diff --git a/scripts/common.py b/scripts/common.py
--- a/scripts/common.py
+++ b/scripts/common.py
@@ -282,7 +282,7 @@ def open_new_tab_in_browser_if_possible(url):
         python_utils.PRINT(
             'Please open the following link in browser: %s' % url)
         return
-    browser_cmds = ['chromium-browser', 'google-chrome', 'firefox']
+    browser_cmds = ['brave', 'chromium-browser', 'google-chrome', 'firefox']
     for cmd in browser_cmds:
         if subprocess.call(['which', cmd]) == 0:
             subprocess.check_call([cmd, url])
diff --git a/scripts/setup.py b/scripts/setup.py
--- a/scripts/setup.py
+++ b/scripts/setup.py
@@ -213,6 +213,9 @@ def main(args=None):
     elif os.path.isfile('/usr/bin/chromium-browser'):
         # Unix.
         chrome_bin = '/usr/bin/chromium-browser'
+    elif os.path.isfile('/usr/bin/brave'):
+        # Arch Linux.
+        chrome_bin = '/usr/bin/brave'
     elif os.path.isfile('/usr/bin/chromium'):
         # Arch Linux.
         chrome_bin = '/usr/bin/chromium'


Test patch:
diff --git a/scripts/setup_test.py b/scripts/setup_test.py
--- a/scripts/setup_test.py
+++ b/scripts/setup_test.py
@@ -465,6 +465,16 @@ def mock_isfile(path):
                     setup.main(args=[])
         self.assertEqual(os.environ['CHROME_BIN'], '/usr/bin/google-chrome')
 
+    def test_chrome_bin_setup_with_brave_browser(self):
+        def mock_isfile(path):
+            return path == '/usr/bin/brave'
+        isfile_swap = self.swap(os.path, 'isfile', mock_isfile)
+        with self.test_py_swap, self.create_swap, self.uname_swap:
+            with self.exists_swap, self.chown_swap, self.chmod_swap:
+                with self.get_swap, isfile_swap:
+                    setup.main(args=[])
+        self.assertEqual(os.environ['CHROME_BIN'], '/usr/bin/brave')
+
     def test_chrome_bin_setup_with_chromium_browser(self):
         def mock_isfile(path):
             return path == '/usr/bin/chromium-browser'
Repository: oppia/oppia

Issue:
Small Typo in core/controllers/admin.py
core/controllers/admin.py
Line 191 
`handlded` -> `handled`
Small Typo in core/controllers/admin.py
core/controllers/admin.py
Line 191 
`handlded` -> `handled`


Discussion:

Resolving patch:
diff --git a/core/controllers/admin.py b/core/controllers/admin.py
--- a/core/controllers/admin.py
+++ b/core/controllers/admin.py
@@ -187,7 +187,7 @@ def get(self):
         feature_flag_dicts = feature_services.get_all_feature_flag_dicts()
 
         config_properties = config_domain.Registry.get_config_property_schemas()
-        # Removes promo-bar related configs as promo-bar is handlded by
+        # Removes promo-bar related configs as promo-bar is handled by
         # release coordinators in /release-coordinator page.
         del config_properties['promo_bar_enabled']
         del config_properties['promo_bar_message']


Test patch:
Repository: oppia/oppia

Issue:
[Contributor Dashboard] Unable to remove question contribution rights in admin dashboard
We're seeing `InvalidInputException
Schema validation for 'language_code' failed: Validation failed: is_supported_audio_language_code ({}) for object null` when trying to remove question contribution rights.

<img width="1272" alt="Screen Shot 2021-11-08 at 4 49 25 PM" src="https://user-images.githubusercontent.com/9004726/140823762-9b72375e-4237-4d2f-a2d2-c06af3e375d8.png">




Discussion:

Resolving patch:
diff --git a/core/controllers/payload_validator.py b/core/controllers/payload_validator.py
--- a/core/controllers/payload_validator.py
+++ b/core/controllers/payload_validator.py
@@ -81,9 +81,7 @@ def validate_arguments_against_schema(
     errors = []
     # Dictionary to hold normalized values of arguments after validation.
     normalized_values = {}
-
     for arg_key, arg_schema in handler_args_schemas.items():
-
         if arg_key not in handler_args or handler_args[arg_key] is None:
             if 'default_value' in arg_schema:
                 if arg_schema['default_value'] is None:


Test patch:
diff --git a/core/controllers/contributor_dashboard_admin_test.py b/core/controllers/contributor_dashboard_admin_test.py
--- a/core/controllers/contributor_dashboard_admin_test.py
+++ b/core/controllers/contributor_dashboard_admin_test.py
@@ -301,7 +301,7 @@ def test_remove_question_reviewer(self):
         self.login(self.QUESTION_ADMIN_EMAIL)
         self.delete_json(
             '/contributionrightshandler/question', params={
-                'username': 'question',
+                'username': 'question'
             })
 
         self.assertFalse(user_services.can_review_question_suggestions(
Repository: oppia/oppia

Issue:
Revert ownership to @BenHenning after 2022-01-04
Add @BenHenning back to CODEOWNERS after 04 January 2021.


Discussion:
Since I'm taking time off again in a few days, extending this to Jan.

Resolving patch:
diff --git a/scripts/linters/codeowner_linter.py b/scripts/linters/codeowner_linter.py
--- a/scripts/linters/codeowner_linter.py
+++ b/scripts/linters/codeowner_linter.py
@@ -29,16 +29,6 @@
 # This list needs to be in sync with the important patterns in the CODEOWNERS
 # file.
 CODEOWNER_IMPORTANT_PATHS = [
-    '/core/templates/services/svg-sanitizer.service.ts',
-    '/scripts/linters/warranted_angular_security_bypasses.py',
-    '/core/controllers/access_validators*.py',
-    '/core/controllers/acl_decorators*.py',
-    '/core/controllers/android_e2e_config*.py',
-    '/core/controllers/base*.py',
-    '/core/domain/html*.py',
-    '/core/domain/rights_manager*.py',
-    '/core/domain/role_services*.py',
-    '/core/domain/user*.py',
     '/core/storage/',
     '/dependencies.json',
     '/package.json',
@@ -54,7 +44,26 @@
     '/.github/workflows/',
     '/core/android_validation_constants*.py',
     '/extensions/interactions/rule_templates.json',
-    '/.rtlcssrc']
+    '/core/templates/services/svg-sanitizer.service.ts',
+    '/scripts/linters/warranted_angular_security_bypasses.py',
+    '/core/controllers/access_validators*.py',
+    '/core/controllers/acl_decorators*.py',
+    '/core/controllers/android_e2e_config*.py',
+    '/core/controllers/base*.py',
+    '/core/domain/html*.py',
+    '/core/domain/rights_manager*.py',
+    '/core/domain/role_services*.py',
+    '/core/domain/user*.py',
+    '/AUTHORS',
+    '/CONTRIBUTORS',
+    '/LICENSE',
+    '/NOTICE',
+    '/core/templates/pages/terms-page/terms-page.component.html',
+    '/core/templates/pages/privacy-page/privacy-page.component.html',
+    '/core/templates/pages/license-page/license-page.component.html',
+    '/core/domain/takeout_*.py',
+    '/core/domain/wipeout_*.py',
+]
 
 
 class CodeownerLintChecksManager:


Test patch:
Repository: oppia/oppia

Issue:
. is seen at the end for an option in Customize interaction(Item Selection) dialog box 
**Describe the bug**
. is seen at the end for an option in Customize interaction(Item Selection) dialog box 

**To Reproduce**
Steps to reproduce the behavior:
 1. Go to 'Creator dashboard'
 2. Click on 'Create Dashboard'- Add Introduction
 3. Click on Add Interaction
 4. Select Item Selection
 5. See dialogbox

**Observed behavior**
. is seen at the end for 'Minimum number of selections permitted' option in Customize interaction(Item Selection) dialog box 

**Expected behavior**
. is not needed at the end of Minimum number of selections permitted.

**Screenshots / Videos**
![Screenshot 2022-09-05 2 07 21 PM](https://user-images.githubusercontent.com/101634267/188407287-24acf555-c2be-41af-bfe8-69628429b1aa.png)

**Desktop (please complete the following information; delete this section if the issue does not arise on desktop):**
OS: Chrome
Browser: chrome
Browser-version: 104.0.5112.83
. is seen at the end for an option in Customize interaction(Item Selection) dialog box 
**Describe the bug**
. is seen at the end for an option in Customize interaction(Item Selection) dialog box 

**To Reproduce**
Steps to reproduce the behavior:
 1. Go to 'Creator dashboard'
 2. Click on 'Create Dashboard'- Add Introduction
 3. Click on Add Interaction
 4. Select Item Selection
 5. See dialogbox

**Observed behavior**
. is seen at the end for 'Minimum number of selections permitted' option in Customize interaction(Item Selection) dialog box 

**Expected behavior**
. is not needed at the end of Minimum number of selections permitted.

**Screenshots / Videos**
![Screenshot 2022-09-05 2 07 21 PM](https://user-images.githubusercontent.com/101634267/188407287-24acf555-c2be-41af-bfe8-69628429b1aa.png)

**Desktop (please complete the following information; delete this section if the issue does not arise on desktop):**
OS: Chrome
Browser: chrome
Browser-version: 104.0.5112.83


Discussion:

Resolving patch:
diff --git a/extensions/interactions/ItemSelectionInput/ItemSelectionInput.py b/extensions/interactions/ItemSelectionInput/ItemSelectionInput.py
--- a/extensions/interactions/ItemSelectionInput/ItemSelectionInput.py
+++ b/extensions/interactions/ItemSelectionInput/ItemSelectionInput.py
@@ -45,7 +45,7 @@ class ItemSelectionInput(base.BaseInteraction):
 
     _customization_arg_specs: List[domain.CustomizationArgSpecsDict] = [{
         'name': 'minAllowableSelectionCount',
-        'description': 'Minimum number of selections permitted.',
+        'description': 'Minimum number of selections permitted',
         'schema': {
             'type': 'int',
             'validators': [{


Test patch:
Repository: oppia/oppia

Issue:
RTE Descriptions Are Not Being Loaded / Displayed
**Describe the bug**
The RTE tag descriptions in the exploration editor that are usually loaded from `rich_text_components_definitions.ts` are no longer being loaded.

**To Reproduce**
Steps to reproduce the behavior:
 1. Go to exploration editor in dev server.
 2. Click on any RTE tag.
 3. See error

**Screenshots / Videos**
<img width="400" alt="image" src="https://user-images.githubusercontent.com/21316782/195219637-55f50ced-cdd8-4f4c-970c-32916b985bba.png">

**Expected Result**
<img width="400" alt="image" src="https://user-images.githubusercontent.com/21316782/195219775-a1333fd5-0653-485b-a25c-1ba6d7bfc11a.png">


**Desktop (please complete the following information; delete this section if the issue does not arise on desktop):**
 - OS: M1 Mac
 - Browser: Chrome and Safari

**Additional context**
This bug has been reproduced on multiple machines already.


Discussion:

Resolving patch:
diff --git a/core/domain/html_cleaner.py b/core/domain/html_cleaner.py
--- a/core/domain/html_cleaner.py
+++ b/core/domain/html_cleaner.py
@@ -79,6 +79,7 @@ def filter_a(tag: str, name: str, value: str) -> bool:
     'code': [],
     'div': [],
     'em': [],
+    'h1': [],
     'hr': [],
     'i': [],
     'li': [],
diff --git a/core/domain/html_validation_service.py b/core/domain/html_validation_service.py
--- a/core/domain/html_validation_service.py
+++ b/core/domain/html_validation_service.py
@@ -44,7 +44,7 @@ def wrap_with_siblings(tag: bs4.element.Tag, p: bs4.element.Tag) -> None:
         p: bs4.element.Tag. The new p tag in soup in which the tag and
             its siblings are to be wrapped.
     """
-    independent_parents = ['p', 'pre', 'ol', 'ul', 'blockquote']
+    independent_parents = ['h1', 'p', 'pre', 'ol', 'ul', 'blockquote']
     prev_sib = list(tag.previous_siblings)
     next_sib = list(tag.next_siblings)
     index_of_first_unwrapped_sibling = -1


Test patch:
Repository: oppia/oppia

Issue:
[Installation Flake] http.client.IncompleteRead
When downloading elasticsearch, we sometimes get this error:

```
Installing ElasticSearch...
Downloading and untarring file elasticsearch-7.17.0 to ../oppia_tools ...
    return _run_code(code, main_globals, None,
  File "/opt/hostedtoolcache/Python/3.8.15/x64/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/runner/work/oppia/oppia/scripts/install_third_party_libs.py", line 249, in <module>
    main()
  File "/home/runner/work/oppia/oppia/scripts/install_third_party_libs.py", line 172, in main
    install_third_party.main(args=[])
  File "/home/runner/work/oppia/oppia/scripts/install_third_party.py", line 524, in main
    install_elasticsearch_dev_server()
  File "/home/runner/work/oppia/oppia/scripts/install_third_party.py", line 437, in install_elasticsearch_dev_server
    download_and_extract(
  File "/home/runner/work/oppia/oppia/scripts/install_third_party.py", line 428, in download_and_extract
    download_and_untar_files(*args)
  File "/home/runner/work/oppia/oppia/scripts/install_third_party.py", line 235, in download_and_untar_files
    common.url_retrieve(source_url, TMP_UNZIP_PATH)
  File "/home/runner/work/oppia/oppia/scripts/common.py", line 867, in url_retrieve
    output_file.write(response.read())
  File "/opt/hostedtoolcache/Python/3.8.15/x64/lib/python3.8/http/client.py", line 472, in read
    s = self._safe_read(self.length)
  File "/opt/hostedtoolcache/Python/3.8.15/x64/lib/python3.8/http/client.py", line 615, in _safe_read
    raise IncompleteRead(data, amt-len(data))
http.client.IncompleteRead: IncompleteRead(223344992 bytes read, 88043528 more expected)
```

To mitigate the problem this causes CI, we should automatically re-try the download.

Examples:
* https://github.com/oppia/oppia/actions/runs/4266669269/jobs/7427611640#step:7:4618
* https://github.com/oppia/oppia/actions/runs/4266669265
* https://github.com/oppia/oppia/actions/runs/4266733678


Discussion:

Resolving patch:
diff --git a/scripts/common.py b/scripts/common.py
--- a/scripts/common.py
+++ b/scripts/common.py
@@ -19,6 +19,7 @@
 import contextlib
 import errno
 import getpass
+from http import client
 import io
 import os
 import platform
@@ -865,7 +866,9 @@ def url_retrieve(
             ) as response:
                 with open(output_path, 'wb') as output_file:
                     output_file.write(response.read())
-        except (urlerror.URLError, ssl.SSLError) as exception:
+        except (
+            urlerror.URLError, ssl.SSLError, client.IncompleteRead
+        ) as exception:
             failures += 1
             print('Attempt %d of %d failed when downloading %s.' % (
                 failures, max_attempts, url))


Test patch:
Repository: oppia/oppia

Issue:
Backend test flake: mis-ordering of exploration states
Example: https://github.com/oppia/oppia/actions/runs/3476372502/jobs/5811542387#step:8:1949

Log:

```
======================================================================
FAIL: test_verify_all_states_reachable (core.domain.exp_domain_test.ExplorationDomainUnitTests)
----------------------------------------------------------------------
core.utils.ValidationError: Please fix the following issues before saving this exploration: 1. The following states are not reachable from the initial state: End 2. It is impossible to complete the exploration from the following states: Introduction, Stuck State 

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/runner/work/oppia/oppia/core/domain/exp_domain_test.py", line 4206, in test_verify_all_states_reachable
    exploration.validate(strict=True)
AssertionError: "Please fix the following issues before saving this exploration: 1. The following states are not reachable from the initial state: End 2. It is impossible to complete the exploration from the following states: Stuck State, Introduction" does not match "Please fix the following issues before saving this exploration: 1. The following states are not reachable from the initial state: End 2. It is impossible to complete the exploration from the following states: Introduction, Stuck State "
```

We likely need to change our assertion so that the order of states does not matter.


Discussion:
This is easy to fix, it just requires adding a sorted() around the definition of  unseen_states in the relevant function in exp_domain.py. Marking this as a starter issue: any contributor who can identify the specific line of code to change and explain why that change works can be assigned to this issue.
Would sorting unseen_states in line 2101 solve the issue as it enforces fixed order every time with the otherwise unordered sets contributing to variable order?
@merryyshen Yes, that should work. But please follow the instructions on our "Getting Started" wiki page if you'd like to contribute a PR, otherwise we can also leave this issue open for other contributors.

Resolving patch:
diff --git a/core/domain/exp_domain.py b/core/domain/exp_domain.py
--- a/core/domain/exp_domain.py
+++ b/core/domain/exp_domain.py
@@ -2098,8 +2098,8 @@ def _verify_all_states_reachable(self) -> None:
                             curr_queue.append(dest_if_stuck_state)
 
         if len(self.states) != len(processed_queue):
-            unseen_states = list(
-                set(self.states.keys()) - set(processed_queue))
+            unseen_states = sorted(list(
+                set(self.states.keys()) - set(processed_queue)))
             raise utils.ValidationError(
                 'The following states are not reachable from the initial '
                 'state: %s' % ', '.join(unseen_states))


Test patch:
Repository: oppia/oppia

Issue:
[Docker] Enable pre-push hooks for Docker setup
At the moment, pre-push hooks haven't been configured for Docker. Considering their importance in the development workflow, this is something to address.
[Docker] Enable pre-push hooks for Docker setup
At the moment, pre-push hooks haven't been configured for Docker. Considering their importance in the development workflow, this is something to address.


Discussion:

Resolving patch:
diff --git a/scripts/pre_push_hook.py b/scripts/pre_push_hook.py
--- a/scripts/pre_push_hook.py
+++ b/scripts/pre_push_hook.py
@@ -46,6 +46,7 @@
 sys.path.append(os.getcwd())
 from scripts import common  # isort:skip  # pylint: disable=wrong-import-position
 from scripts import install_python_prod_dependencies # isort:skip  # pylint: disable=wrong-import-position
+from core import feconf #isort:skip # pylint: disable=wrong-import-position
 
 GitRef = collections.namedtuple(
     'GitRef', ['local_ref', 'local_sha1', 'remote_ref', 'remote_sha1'])
@@ -60,7 +61,11 @@
 FILE_DIR: Final = os.path.abspath(os.path.dirname(__file__))
 OPPIA_DIR: Final = os.path.join(FILE_DIR, os.pardir, os.pardir)
 LINTER_FILE_FLAG: Final = '--files'
-PYTHON_CMD: Final = 'python'
+
+# Path to currently running python interpreter,
+# it is required to resolve python version conflict in docker.
+PYTHON_CMD: Final = sys.executable if feconf.OPPIA_IS_DOCKERIZED else 'python'
+
 OPPIA_PARENT_DIR: Final = os.path.join(
     FILE_DIR, os.pardir, os.pardir, os.pardir
 )


Test patch: