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

Issue:
Remove jinja from preferences-page.directive.html
<!--
  - 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)._
  -->
Remove jinja as used [here](https://github.com/oppia/oppia/blob/4f769257fbe780d9ef421b6d548e46020028cc23/core/templates/dev/head/pages/preferences-page/preferences-page.directive.html#L195) in the preferences page directive.


Discussion:

Resolving patch:
diff --git a/core/controllers/profile.py b/core/controllers/profile.py
--- a/core/controllers/profile.py
+++ b/core/controllers/profile.py
@@ -386,6 +386,8 @@ def get(self):
                 'preferred_site_language_code': (
                     user_settings.preferred_site_language_code),
                 'username': user_settings.username,
+                'email': user_services.get_email_from_username(
+                    user_settings.username),
                 'user_is_logged_in': True
             })
         else:


Test patch:
diff --git a/core/controllers/profile_test.py b/core/controllers/profile_test.py
--- a/core/controllers/profile_test.py
+++ b/core/controllers/profile_test.py
@@ -853,6 +853,7 @@ def test_user_info_handler(self):
             'can_create_collections': False,
             'preferred_site_language_code': None,
             'username': self.EDITOR_USERNAME,
+            'email': self.EDITOR_EMAIL,
             'user_is_logged_in': True}, json_response)
         self.logout()
Repository: oppia/oppia

Issue:
Integrate extensions/interactions/LogicProof/static/js into webpack
### Problem
There are some TypeScript files in `extensions/interactions/LogicProof/static/js` that we include by script-imports in `extensions/dependencies/logic_proof.html`. We should integrate them into webpack.

### Solution
1. Add `require(…)` into the files in `extensions/interactions/LogicProof/static/js` if needed (if they depend on each other)
2. Find out from where we use these files and add the `require(…)` there
Integrate extensions/interactions/LogicProof/static/js into webpack
### Problem
There are some TypeScript files in `extensions/interactions/LogicProof/static/js` that we include by script-imports in `extensions/dependencies/logic_proof.html`. We should integrate them into webpack.

### Solution
1. Add `require(…)` into the files in `extensions/interactions/LogicProof/static/js` if needed (if they depend on each other)
2. Find out from where we use these files and add the `require(…)` there


Discussion:

Resolving patch:
diff --git a/extensions/interactions/LogicProof/LogicProof.py b/extensions/interactions/LogicProof/LogicProof.py
--- a/extensions/interactions/LogicProof/LogicProof.py
+++ b/extensions/interactions/LogicProof/LogicProof.py
@@ -26,7 +26,7 @@ class LogicProof(base.BaseInteraction):
     description = (
         'Allows learners to write proofs for simple logical statements.')
     display_mode = base.DISPLAY_MODE_SUPPLEMENTAL
-    _dependency_ids = ['logic_proof', 'codemirror']
+    _dependency_ids = ['codemirror']
     answer_type = 'CheckedProof'
     instructions = 'Construct a proof'
     narrow_instructions = 'Construct a proof'
diff --git a/scripts/pre_commit_linter.py b/scripts/pre_commit_linter.py
--- a/scripts/pre_commit_linter.py
+++ b/scripts/pre_commit_linter.py
@@ -103,8 +103,8 @@
     '*.mp3', '*.mp4', 'node_modules/*', 'typings/*', 'local_compiled_js/*')
 
 GENERATED_FILE_PATHS = (
-    'extensions/interactions/LogicProof/static/js/generatedDefaultData.js',
-    'extensions/interactions/LogicProof/static/js/generatedParser.js',
+    'extensions/interactions/LogicProof/static/js/generatedDefaultData.ts',
+    'extensions/interactions/LogicProof/static/js/generatedParser.ts',
     'core/templates/dev/head/expressions/ExpressionParserService.js')
 
 CONFIG_FILE_PATHS = (


Test patch:
diff --git a/core/domain/interaction_registry_test.py b/core/domain/interaction_registry_test.py
--- a/core/domain/interaction_registry_test.py
+++ b/core/domain/interaction_registry_test.py
@@ -40,7 +40,7 @@ def test_deduplication_of_dependency_ids(self):
         self.assertItemsEqual(
             interaction_registry.Registry.get_deduplicated_dependency_ids(
                 ['CodeRepl', 'LogicProof']),
-            ['skulpt', 'codemirror', 'logic_proof'])
+            ['skulpt', 'codemirror'])
 
 
 class InteractionRegistryUnitTests(test_utils.GenericTestBase):
Repository: oppia/oppia

Issue:
Upgrade @typescript-eslint/eslint-plugin
`eslint-utils` is currently out of date, https://github.com/oppia/oppia/pull/7451 provides a temporary fix, but we need to upgrade the main package that requires `eslint-utils` to ensure that we have a long term fix. 

When fixing this, please make sure that the lint tests run successfully.


Discussion:

Resolving patch:
diff --git a/core/domain/feedback_jobs_one_off.py b/core/domain/feedback_jobs_one_off.py
--- a/core/domain/feedback_jobs_one_off.py
+++ b/core/domain/feedback_jobs_one_off.py
@@ -13,6 +13,7 @@
 # limitations under the License.
 
 """One-off jobs for feedback models."""
+from __future__ import absolute_import # pylint: disable=import-only-modules
 
 from core import jobs
 from core.platform import models


Test patch:
diff --git a/core/domain/feedback_jobs_one_off_test.py b/core/domain/feedback_jobs_one_off_test.py
--- a/core/domain/feedback_jobs_one_off_test.py
+++ b/core/domain/feedback_jobs_one_off_test.py
@@ -13,6 +13,7 @@
 # limitations under the License.
 
 """Tests for Feedback-related jobs."""
+from __future__ import absolute_import # pylint: disable=import-only-modules
 
 import ast
Repository: oppia/oppia

Issue:
Presubmit Checks Fail for Clean Repository
<!--
  - Thanks for taking the time to report a bug in 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)._
  -->

**Describe the bug**

When running the presubmit checks in a clean repository (all changes stashed or committed), the checks fail because there are no un-committed files to lint.

**To Reproduce**

Steps to reproduce the behavior:
1. Checkout `develop` (as of this issue, `develop` is at fbe01ab): `git checkout develop`
2. Drop any un-committed changes: `git checkout HEAD --hard`
3. Run presubmit checks: `bash scripts/run_presubmit_checks.sh

**Observed behavior**

```console
$ bash scripts/run_presubmit_checks.sh 
Linting files since the last commit
---------------------------
No files to check.
---------------------------
$ # checks fail
```

**Expected behavior**

The checks should continue, and pass if there are no other problems.

**Desktop (please complete the following information; delete this section if the issue does not arise on desktop):**
 - OS: [e.g. iOS] macOS
 - Browser [e.g. chrome, safari] N/A
 - Version [e.g. 22] fbe01ab

**Additional context**

This behavior occurs because [here](https://github.com/oppia/oppia/blob/develop/scripts/pre_commit_linter.py#L3167), the pre-commit linter exits with code 1 if there are no files to lint. This change was introduced in #6497 .

cc @kevinlee12 @sauravpratihar 


Discussion:

Resolving patch:
diff --git a/scripts/pre_commit_linter.py b/scripts/pre_commit_linter.py
--- a/scripts/pre_commit_linter.py
+++ b/scripts/pre_commit_linter.py
@@ -3164,7 +3164,7 @@ def main():
         python_utils.PRINT('---------------------------')
         python_utils.PRINT('No files to check.')
         python_utils.PRINT('---------------------------')
-        sys.exit(1)
+        return
 
     all_filepaths_dict = {
         '.py': [], '.html': [], '.ts': [], '.js': [], 'other': [], '.css': []


Test patch:
Repository: oppia/oppia

Issue:
Not able to push my branch
I'm currently not able to push my branch. I've deleted oppia_modules, third_party, local_compiled_js etc and started start.sh too. But no luck!

![image](https://user-images.githubusercontent.com/22434689/65391539-0aeb6300-dd88-11e9-9368-44d9070d2fd3.png)


cc/ @oppia/dev-workflow-team 


Discussion:
I'm able to push it right now. All I did is repeated the steps I did a while back. Fetched the updated develop, deleted all the generated folders, started start.sh and tried again. 

I've seen this occurs few times -- flaky. Any idea of what is causing this?
can you check what version of nodejs you have? `nodejs --version` should get you the result.
I've a folder node10.15.3 in oppia_tools.

Resolving patch:
diff --git a/scripts/setup.py b/scripts/setup.py
--- a/scripts/setup.py
+++ b/scripts/setup.py
@@ -162,6 +162,7 @@ def main(args=None):
             'do *NOT* use npm. For more information on how to use yarn,',
             'visit https://yarnpkg.com/en/docs/usage.'])
 
+        # NB: Update .yarnrc if the yarn version below is changed.
         yarn_version = 'v1.17.3'
         yarn_file_name = 'yarn-%s.tar.gz' % yarn_version
         python_utils.url_retrieve(


Test patch:
diff --git a/scripts/run_e2e_tests.sh b/scripts/run_e2e_tests.sh
--- a/scripts/run_e2e_tests.sh
+++ b/scripts/run_e2e_tests.sh
@@ -96,6 +96,15 @@ if ( nc -vz localhost 9001 ); then
   exit 1
 fi
 
+export OPPIA_DIR=`pwd`
+# Set COMMON_DIR to the absolute path of the directory above OPPIA_DIR. This
+# is necessary becaue COMMON_DIR (or subsequent variables which refer to it)
+# may use it in a situation where relative paths won't work as expected (such
+# as $PYTHONPATH).
+export COMMON_DIR=$(cd $OPPIA_DIR/..; pwd)
+export TOOLS_DIR=$COMMON_DIR/oppia_tools
+export NODE_PATH=$TOOLS_DIR/node-10.15.3
+export PATH=$NODE_PATH/bin:$PATH
 
 # Forces the cleanup function to run on exit.
 # Developers: note that at the end of this script, the cleanup() function at
Repository: oppia/oppia

Issue:
Pre commit linter should call the necessary scripts to ensure that dependencies are installed
Currently our precommit linter assumes that a set number of dependencies (from install_third_party_libs.py) are installed when running. Instead, there should be a call to our scripts to ensure that the relevant dependencies are installed when the precommit hook is run. Keep in mind that this should not bog down the time to commit, in other words, if the contributor already has the dependencies installed, it shouldn't add more time to the commit process. 
Pre commit linter should call the necessary scripts to ensure that dependencies are installed
Currently our precommit linter assumes that a set number of dependencies (from install_third_party_libs.py) are installed when running. Instead, there should be a call to our scripts to ensure that the relevant dependencies are installed when the precommit hook is run. Keep in mind that this should not bog down the time to commit, in other words, if the contributor already has the dependencies installed, it shouldn't add more time to the commit process. 


Discussion:

Resolving patch:
diff --git a/scripts/pre_commit_linter.py b/scripts/pre_commit_linter.py
--- a/scripts/pre_commit_linter.py
+++ b/scripts/pre_commit_linter.py
@@ -23,15 +23,6 @@
 
 This script ignores all filepaths contained within .eslintignore.
 
-IMPORTANT NOTES:
-
-1.  Before running this script, you must install third-party dependencies by
-    running
-
-        python -m scripts.install_third_party_libs
-
-    at least once.
-
 =====================
 CUSTOMIZATION OPTIONS
 =====================
@@ -71,7 +62,12 @@
 import threading
 import time
 
-import python_utils
+# Install third party dependencies before proceeding.
+from . import install_third_party_libs
+install_third_party_libs.main(args=[])
+
+# pylint: disable=wrong-import-position
+import python_utils  # isort:skip
 
 _PARSER = argparse.ArgumentParser()
 _EXCLUSIVE_GROUP = _PARSER.add_mutually_exclusive_group()


Test patch:
Repository: oppia/oppia

Issue:
Presubmit checks command not working
Running `python -m scripts.run_presubmit_checks` is failing with the following error:

![image](https://user-images.githubusercontent.com/22434689/65747636-8bf78100-e11f-11e9-88e3-916a116a0dde.png)

FYI, `python -m scripts.pre_commit_linter` runs fine.
Presubmit checks command not working
Running `python -m scripts.run_presubmit_checks` is failing with the following error:

![image](https://user-images.githubusercontent.com/22434689/65747636-8bf78100-e11f-11e9-88e3-916a116a0dde.png)

FYI, `python -m scripts.pre_commit_linter` runs fine.


Discussion:
@kevinlee12, `FILE_CACHE` was introduced in #7591 and calling `pre_commit_linter.main` directly causing this error. I've raised a comment [here](https://github.com/oppia/oppia/pull/7591/files#r328951038), do we use `run_presubmit_checks` file anywhere?  
@cuichenli, can you take a look at this? thanks!
@kevinlee12, `FILE_CACHE` was introduced in #7591 and calling `pre_commit_linter.main` directly causing this error. I've raised a comment [here](https://github.com/oppia/oppia/pull/7591/files#r328951038), do we use `run_presubmit_checks` file anywhere?  
@cuichenli, can you take a look at this? thanks!

Resolving patch:
diff --git a/scripts/pre_commit_linter.py b/scripts/pre_commit_linter.py
--- a/scripts/pre_commit_linter.py
+++ b/scripts/pre_commit_linter.py
@@ -3384,9 +3384,11 @@ def main(args=None):
         python_utils.PRINT('---------------------------')
 
 
+NAME_SPACE = multiprocessing.Manager().Namespace()
+PROCESSES = multiprocessing.Manager().dict()
+NAME_SPACE.files = FileCache()
+FILE_CACHE = NAME_SPACE.files
+
+
 if __name__ == '__main__':
-    NAME_SPACE = multiprocessing.Manager().Namespace()
-    PROCESSES = multiprocessing.Manager().dict()
-    NAME_SPACE.files = FileCache()
-    FILE_CACHE = NAME_SPACE.files
     main()


Test patch:
Repository: oppia/oppia

Issue:
PR is pushed even if frontend test fails
It happened that I issued git push on my PR, the frontend tests failed but still the PR was pushed which is not something expected.

Screenshot:
![image](https://user-images.githubusercontent.com/22434689/66855976-db540300-efa1-11e9-9acc-212d02157dde.png)

PR is pushed even if frontend test fails
It happened that I issued git push on my PR, the frontend tests failed but still the PR was pushed which is not something expected.

Screenshot:
![image](https://user-images.githubusercontent.com/22434689/66855976-db540300-efa1-11e9-9acc-212d02157dde.png)



Discussion:
I am able to reproduce this too.

<img width="1143" alt="Screenshot 2019-10-15 at 11 43 55 PM" src="https://user-images.githubusercontent.com/15226041/66857814-aba6fa00-efa5-11e9-80a8-2fb9d9943133.png">

I am able to reproduce this too.

<img width="1143" alt="Screenshot 2019-10-15 at 11 43 55 PM" src="https://user-images.githubusercontent.com/15226041/66857814-aba6fa00-efa5-11e9-80a8-2fb9d9943133.png">


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
@@ -277,6 +277,7 @@ def _start_python_script(scriptname):
         os.path.join('scripts', scriptname).replace('/', '.')]
     task = subprocess.Popen(cmd)
     task.communicate()
+    task.wait()
     return task.returncode
 
 


Test patch:
diff --git a/scripts/run_frontend_tests.py b/scripts/run_frontend_tests.py
--- a/scripts/run_frontend_tests.py
+++ b/scripts/run_frontend_tests.py
@@ -19,6 +19,7 @@
 import argparse
 import os
 import subprocess
+import sys
 
 import python_utils
 
@@ -65,9 +66,13 @@ def main(args=None):
 
     build.main(args=[])
 
-    subprocess.call([
+    cmd = [
         os.path.join(common.NODE_MODULES_PATH, 'karma', 'bin', 'karma'),
-        'start', os.path.join('core', 'tests', 'karma.conf.ts')])
+        'start', os.path.join('core', 'tests', 'karma.conf.ts')]
+
+    task = subprocess.Popen(cmd)
+    task.communicate()
+    task.wait()
 
     if parsed_args.run_minified_tests is True:
         python_utils.PRINT('Running test in production environment')
@@ -80,6 +85,7 @@ def main(args=None):
             '--prodEnv'])
 
     python_utils.PRINT('Done!')
+    sys.exit(task.returncode)
 
 
 if __name__ == '__main__':
Repository: oppia/oppia

Issue:
Exploration Cards Show "Invalid date" as date
**Describe the bug**
In the library, exploration cards have `Invalid date` in the lower right-hand corner.

**To Reproduce**
Steps to reproduce the behavior:
 1. Go to https://oppiatestserver.appspot.com/library

**Observed behavior**
The exploration cards show `Invalid date`

**Expected behavior**
The cards should show the creation date.

**Screenshots**

![Screen Shot 2019-11-10 at 17 41 34](https://user-images.githubusercontent.com/19878639/68556295-7c3dae80-03e6-11ea-950c-21829cb7d26e.png)

**Desktop (please complete the following information; delete this section if the issue does not arise on desktop):**
 - OS: macOS
 - Browser: Firefox
 - Version: 2.8.7
Publish change button has overflowing text
**Describe the bug**
Publish change text while publishing a collection moves out of the button box.

**To Reproduce**
Steps to reproduce the behavior:
 1. Create a collection and check the publish button. The text moves out of the button box.

**Screenshots**
<img width="1440" alt="Screenshot 2019-11-14 at 12 35 14 AM" src="https://user-images.githubusercontent.com/15226041/68795290-a9a08b80-0676-11ea-8b46-57b6b68c3077.png">


**Desktop (please complete the following information; delete this section if the issue does not arise on desktop):**
 - OS: Mac
 - Browser: Chrome




Discussion:
Hey @ankita240796 I encountered a similar bug while testing, maybe your fix will solve this too. It's supposed to be time there right? Also maybe this will help you to find the relevant code faster.

![Screenshot 2019-11-11 at 10 24 59 PM](https://user-images.githubusercontent.com/30312043/68612841-737ed280-04e3-11ea-829d-b2f82ab6e829.png)

Thanks @Showtim3! I am taking a look into this!



Resolving patch:
diff --git a/scripts/typescript_checks.py b/scripts/typescript_checks.py
--- a/scripts/typescript_checks.py
+++ b/scripts/typescript_checks.py
@@ -54,11 +54,11 @@ def compile_and_check_typescript():
         './node_modules/typescript/bin/tsc', '--project',
         TSCONFIG_FILEPATH]
     process = subprocess.Popen(cmd, stdout=subprocess.PIPE)
-    if os.path.exists(COMPILED_JS_DIR):
-        shutil.rmtree(COMPILED_JS_DIR)
     error_messages = []
     for line in iter(process.stdout.readline, ''):
         error_messages.append(line)
+    if os.path.exists(COMPILED_JS_DIR):
+        shutil.rmtree(COMPILED_JS_DIR)
     if error_messages:
         python_utils.PRINT('Errors found during compilation\n')
         for message in error_messages:


Test patch:
Repository: oppia/oppia

Issue:
Lint test for fdescribe in spec file fails test without any clear log
Lint test for fdescribe in spec.ts file fails test without any clear log.

**Steps to reproduce:**
- Open any *spec.ts file. 
- Change `describe` to `fdescribe`.
- Run `python -m scripts.pre_commit_linter`

**Observed behavior:**
- Lint test fails but there isn't any log for the failure.

**Expected behavior:**
The lint test should fail with proper log stating the reason for the failure.
Lint test for fdescribe in spec file fails test without any clear log
Lint test for fdescribe in spec.ts file fails test without any clear log.

**Steps to reproduce:**
- Open any *spec.ts file. 
- Change `describe` to `fdescribe`.
- Run `python -m scripts.pre_commit_linter`

**Observed behavior:**
- Lint test fails but there isn't any log for the failure.

**Expected behavior:**
The lint test should fail with proper log stating the reason for the failure.


Discussion:
@kevinlee12, Can we prioritize this (I think this can be fixed quickly)? Considering this can be painful for contributors, I have already wasted a lot of time finding the reason for the error.  
I'm already looking into this.
@kevinlee12, I think adding a print statement around [this line](https://github.com/oppia/oppia/blob/develop/scripts/pre_commit_linter.py#L1053) will fix the issue. Should I initiate a PR for the same? 
After initial examination, Sandeep and I believe that it is the result of bad pattern check issues, but I'll have to hand this issue over to someone else.
This happens for `fit` as well.
I assume this should be happening for all the patterns mentioned in `BAD_PATTERNS_MAP`.
@kevinlee12, Can we prioritize this (I think this can be fixed quickly)? Considering this can be painful for contributors, I have already wasted a lot of time finding the reason for the error.  
I'm already looking into this.
@kevinlee12, I think adding a print statement around [this line](https://github.com/oppia/oppia/blob/develop/scripts/pre_commit_linter.py#L1053) will fix the issue. Should I initiate a PR for the same? 
After initial examination, Sandeep and I believe that it is the result of bad pattern check issues, but I'll have to hand this issue over to someone else.
This happens for `fit` as well.
I assume this should be happening for all the patterns mentioned in `BAD_PATTERNS_MAP`.

Resolving patch:
diff --git a/scripts/pre_commit_linter.py b/scripts/pre_commit_linter.py
--- a/scripts/pre_commit_linter.py
+++ b/scripts/pre_commit_linter.py
@@ -1874,7 +1874,8 @@ def _check_bad_patterns(
 
     def _check_patterns(self):
         """Run checks relate to bad patterns."""
-        args = ((_FILES['.js'] + _FILES['.ts']), [], self.process_manager)
+        args = (
+            (_FILES['.js'] + _FILES['.ts']), _STDOUT_LIST, self.process_manager)
         methods = [
             (self._check_bad_patterns, args),
             (self._check_mandatory_patterns, args)]


Test patch: