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

Issue:
Docs contains template option for init role that actually does not exists
There are option documented here https://molecule.readthedocs.io/en/latest/usage.html#cmdoption-molecule-init-role-foo-template-path-arg-molecule
```
% molecule --version            
molecule 3.0.8
   ansible==2.9.11 python==3.8

```
but missed in command line
```
% molecule init role --template 111
Usage: molecule init role [OPTIONS] ROLE_NAME
Try 'molecule init role --help' for help.

Error: no such option: --template
zsh: exit 2     molecule init role --template 111
```


Discussion:

Resolving patch:
diff --git a/molecule/command/init/role.py b/molecule/command/init/role.py
--- a/molecule/command/init/role.py
+++ b/molecule/command/init/role.py
@@ -43,10 +43,6 @@ class Role(base.Base):
 
         Initialize a new role.
 
-    .. program:: molecule init role foo --template path
-
-    .. option:: molecule init role foo --template path
-
         Initialize a new role using ansible-galaxy and include default
         molecule directory. Please refer to the ``init scenario``
         command in order to generate a custom ``molecule`` scenario.


Test patch:
Repository: ansible/molecule

Issue:
remnants of ansible-lint in molecule docs
<!--- Verify first that your issue is not already reported on GitHub -->
<!--- Do not report bugs before reproducing them with the code of the main branch! -->
<!--- Please also check https://molecule.readthedocs.io/en/latest/faq.html --->
<!--- Please use https://groups.google.com/forum/#!forum/molecule-users for usage questions -->

# Issue Type

- Bug report

# Molecule and Ansible details

Note: the python was installed via conda, but the python packages are installed using pip, not conda.
```
ansible [core 2.12.2]
  python version = 3.9.10 | packaged by conda-forge | (main, Feb  1 2022, 21:25:34) [Clang 11.1.0 ]
  jinja version = 3.0.3
  libyaml = True
  ansible python module location = /opt/homebrew/Caskroom/miniconda/base/envs/tmptest/lib/python3.9/site-packages/ansible
molecule 3.6.1 using python 3.9
    ansible:2.12.2
    delegated:3.6.1 from molecule
```

Molecule installation method (one of):

- pip

Ansible installation method (one of):

- pip

Detail any linters or test runners used:

ansible-lint

# Desired Behavior

Assuming ansible-lint was removed for good reason and shouldn't be added back into the `molecule[lint]` extra:

I think this would make clearer ansible-lint is never installed by molecule:
* add note here that ansible-lint is not installed by molecule, even if you installed the `[lint]` extra
 https://molecule.readthedocs.io/en/latest/configuration.html?highlight=ansible-lint#lint
* remove misleading comment in setup.cfg https://github.com/ansible-community/molecule/blob/c33c205b570cd95d599d16afa8772fabba51dd40/setup.cfg#L112
* change to actual default (yamllint) https://github.com/ansible-community/molecule/blob/c7ae6a27bed9ba6423d6dfe11d8e0d5c54da094f/src/molecule/command/init/scenario.py#L165




# Actual Behaviour

I can't say for sure (don't know project history well enough) but I *think* ansible-lint was once available through the `molecule[lint]` extra, but was subsequently promoted to a regular dependency, and eventually removed from molecule deps altogether. It appears there were a few spots in docs that got missed and may mislead a new user (see: me) into thinking ansible-lint will be installed with `pip install molecule[lint]` when in fact it is not.






Discussion:

Resolving patch:
diff --git a/src/molecule/command/init/scenario.py b/src/molecule/command/init/scenario.py
--- a/src/molecule/command/init/scenario.py
+++ b/src/molecule/command/init/scenario.py
@@ -162,7 +162,7 @@ def _default_scenario_exists(ctx, param, value: str):  # pragma: no cover
     "--lint-name",
     type=click.Choice(["yamllint"]),
     default="yamllint",
-    help="Name of lint to initialize. (ansible-lint)",
+    help="Name of lint to initialize. (yamllint)",
 )
 @click.option(
     "--provisioner-name",


Test patch:
Repository: ansible/molecule

Issue:
Missing `f` prefix on f-strings
Some strings looks like they're meant to be f-strings but are missing the `f` prefix meaning variable interpolation won't happen.

https://github.com/ansible-community/molecule/blob/19381a8a564f8013453b8dfb08b677fd81c2e358/src/molecule/scenarios.py#L85

I found this issue automatically. I'm a bot. Beep Boop 🦊. See other issues I found in your repo [here](https://codereview.doctor/ansible-community/molecule)


Discussion:

Resolving patch:
diff --git a/src/molecule/scenarios.py b/src/molecule/scenarios.py
--- a/src/molecule/scenarios.py
+++ b/src/molecule/scenarios.py
@@ -82,7 +82,7 @@ def sequence(self, scenario_name: str) -> List[str]:
         for scenario in self.all:
             if scenario.name == scenario_name:
                 return [action for action in scenario.sequence]
-        raise RuntimeError("Unable to find sequence for {scenario_name} scenario.")
+        raise RuntimeError(f"Unable to find sequence for {scenario_name} scenario.")
 
     def _verify(self):
         """


Test patch:
Repository: hedyorg/hedy

Issue:
Request: additional operators in `if` condition
I would like to have used `or` and maybe also having `in` would be good (one kid had a program that tested if the input is in a range she put in a list).


Discussion:

Resolving patch:
diff --git a/hedy.py b/hedy.py
--- a/hedy.py
+++ b/hedy.py
@@ -136,8 +136,12 @@ def ifs(self, args):
         return self.pass_arguments(args)
     def ifelse(self, args):
         return self.pass_arguments(args)
+    def condition(self, args):
+        return self.pass_arguments(args)
     def equality_check(self, args):
         return self.pass_arguments(args)
+    def in_list_check(self, args):
+        return self.pass_arguments(args)
     #level 5 command
     def repeat(self, args):
         return self.pass_arguments(args)
@@ -259,18 +263,21 @@ def list_access_var(self, args):
     def ifs(self, args):
         return f"""if {args[0]}:
 {indent(args[1])}"""
-    def equality_check(self, args):
-        arg0 = wrap_non_var_in_quotes(args[0], self.lookup)
-        arg1 = wrap_non_var_in_quotes(args[1], self.lookup)
-        if len(args) == 2:
-            return f"{arg0} == {arg1}" #no and statements
-        else:
-            return f"{arg0} == {arg1} and {args[2]}"
     def ifelse(self, args):
         return f"""if {args[0]}:
 {indent(args[1])}
 else:
 {indent(args[2])}"""
+    def condition(self, args):
+        return ' and '.join(args)
+    def equality_check(self, args):
+        arg0 = wrap_non_var_in_quotes(args[0], self.lookup)
+        arg1 = wrap_non_var_in_quotes(args[1], self.lookup)
+        return f"{arg0} == {arg1}" #no and statements
+    def in_list_check(self, args):
+        arg0 = wrap_non_var_in_quotes(args[0], self.lookup)
+        arg1 = wrap_non_var_in_quotes(args[1], self.lookup)
+        return f"{arg0} in {arg1}"
 
 class ConvertToPython_5(ConvertToPython_4):
     def number(self, args):


Test patch:
diff --git a/tests.py b/tests.py
--- a/tests.py
+++ b/tests.py
@@ -333,6 +333,18 @@ def test_print_if_with_var(self):
         self.assertEqual(expected_result, result)
         self.assertEqual(run_code(result),'gelijkspel!')
 
+    def test_if_in_array(self):
+        actual = hedy.transpile("items is red, green\nselected is red\nif selected in items print 'found!'", 4)
+
+        expected = """import random
+items = ['red', 'green']
+selected = 'red'
+if selected in items:
+  print('found!')"""
+
+        self.assertEqual(expected, actual)
+        self.assertEqual('found!', run_code(actual))
+
 class TestsLevel5(unittest.TestCase):
     #print should still work
     def test_print_with_var(self):
Repository: hedyorg/hedy

Issue:
Allow admin to see all programs
Would be great if the Hedy/Admin user can see all programs, to aid in lessons. That saves kids with an issue from screensharing or copy-pasting programs to get help. It now shows:

![image](https://user-images.githubusercontent.com/1003685/107973597-af8dc680-6fb5-11eb-8376-2b0165d7ef31.png)

(This error message maybe for other users should be something like: "Unauthorized access" rather than "No such program"?)


Discussion:
We can definitely allow the admin user to look at all programs. Great idea!

Regarding the 404 (not found) instead of a 403 (unauthorized), it's a security practice I saw implemented to give away as little info as possible - so if someone's trying to figure out if there's a program with id X that doesn't belong to them, they cannot tell whether it exists or not. I admit it's a bit silly to prevent randomly created IDs from being guessed, but it is the application of a general security principle (it would be far less innocent if this referred to named documents or users, which is where the principle comes from). I can change it back to a 403 if you want :).
Yeah you are right, it is somewhat of an exposure if we should that the program exists rather than it not being accessible to this user, so we can leave that as is.

But allowing the admin to see programs (and in the far future: allowing teachers to add kids to their class, see https://github.com/Felienne/hedy/issues/152) would be great!

Resolving patch:
diff --git a/app.py b/app.py
--- a/app.py
+++ b/app.py
@@ -201,7 +201,10 @@ def index(level, step):
     # If step is a string that has more than two characters, it must be an id of a program
     if step and type_check (step, 'str') and len (step) > 2:
         result = db_get ('programs', {'id': step})
-        if not result or result ['username'] != current_user(request) ['username']:
+        if not result:
+            return 'No such program', 404
+        # Allow both the owner of the program and the admin user to access the program
+        if current_user(request) != os.getenv ('ADMIN_USER') and result ['username'] != current_user(request) ['username']:
             return 'No such program', 404
         loaded_program = result ['code']
         # We default to step 1 to provide a meaningful default assignment


Test patch:
Repository: hedyorg/hedy

Issue:
Include button to go back to previous level
Thanks for the great project! While trying the website I wished I could go back one level, but there is only a button to go to the next level.


Discussion:
@mattijn great idea! We'll work on it very soon. We'll keep you updated.

Resolving patch:
diff --git a/hedyweb.py b/hedyweb.py
--- a/hedyweb.py
+++ b/hedyweb.py
@@ -37,6 +37,7 @@ def render_assignment_editor(request, course, level_number, assignment_number, m
   arguments_dict['assignment_nr'] = assignment.step  # Give this a chance to be 'None'
   arguments_dict['lang'] = course.language
   arguments_dict['level'] = assignment.level
+  arguments_dict['prev_level'] = int(level_number) - 1 if int(level_number) > 1 else None
   arguments_dict['next_level'] = int(level_number) + 1 if int(level_number) < course.max_level() else None
   arguments_dict['next_assignment'] = int(assignment_number) + 1 if int(assignment_number) < course.max_step(level_number) else None
   arguments_dict['menu'] = menu


Test patch:
Repository: hedyorg/hedy

Issue:
When a user is not logged in, UI still shows name box and save button
Better to remove that when not logged in, found this to be confusing for kids.


Discussion:

Resolving patch:
diff --git a/auth.py b/auth.py
--- a/auth.py
+++ b/auth.py
@@ -305,6 +305,7 @@ def get_profile (user):
             output ['gender'] = user ['gender']
         if 'verification_pending' in user:
             output ['verification_pending'] = True
+        output ['session_expires_at'] = timems () + session_length * 1000
 
         return jsonify (output), 200
 


Test patch:
diff --git a/tests_e2e.py b/tests_e2e.py
--- a/tests_e2e.py
+++ b/tests_e2e.py
@@ -3,9 +3,9 @@
 import random
 from utils import type_check, timems
 import urllib.parse
+from config import config
 
-# TODO: unhardcode port
-host = 'http://localhost:5000/'
+host = 'http://localhost:' + str (config ['port']) + '/'
 
 t0 = timems ()
 
@@ -111,6 +111,14 @@ def getProfile1(state, response):
         raise Exception ('Invalid username (getProfile1)')
     if profile ['email'] != username + '@domain.com':
         raise Exception ('Invalid username (getProfile1)')
+    if not profile ['session_expires_at']:
+        raise Exception ('No session_expires_at (getProfile1)')
+    expire = profile ['session_expires_at'] - config ['session'] ['session_length'] * 60 * 1000 - timems ()
+    if expire > 0:
+        raise Exception ('Invalid session_expires_at (getProfile1), too large')
+    # We give the server up to 10ms to respond to the query
+    if expire < -10:
+        raise Exception ('Invalid session_expires_at (getProfile1), too small')
 
 def getProfile2(state, response):
     profile = response ['body']
Repository: hedyorg/hedy

Issue:
If Hedy is in Another language than Dutch and a mistake is made, the error message still appears in Dutch
The error message recommending print instead of prit for example still appears to be Dutch.
This also occurs for every other available language.
![image](https://user-images.githubusercontent.com/23657961/109020123-f8323780-76b9-11eb-9c05-164e3a050f0d.png)




Discussion:
I've been unable to reproduce the error. I do see it in English 
![print](https://user-images.githubusercontent.com/1058925/109038940-8d3e2c00-76cc-11eb-8ceb-3f0cc4179a56.png)


What if you change the language to Spanish? Does it translate to Spanish then?

This bug occurred for me on Chrome and Firefox but with Edge it the error message did appear in English.
When I changed the language to Spanish in Edge, the error message was still in English.
It translates the first message "The server...." to Spanish. The second one "prit is ...." is still shown in English
Yes that is the what also occurs to me! But if I use Chrome or Firefox then the second line is in Dutch for me.
I also saw this issue today! In my case it mixes Dutch and (f.e.) Portugese

If I use this code in Level 4:
```
option is ask Rock Paper or Scissors?
print 'Player 2 ' option
if option is Scissors
    print 'Its a tie!
```

![image](https://user-images.githubusercontent.com/1003685/109136242-354d0700-7758-11eb-80a9-668cb759dba7.png)

This was Chrome on Macos

When debugging, I see lang sometimes is None, that probably causes this, but I do not understand what causes lang to be None...

![image](https://user-images.githubusercontent.com/1003685/109136676-a8567d80-7758-11eb-9c5d-f55acc50e6e3.png)


Resolving patch:
diff --git a/app.py b/app.py
--- a/app.py
+++ b/app.py
@@ -96,6 +96,10 @@ def parse():
 
     code = body ['code']
     level = int(body ['level'])
+    # Language should come principally from the request body,
+    # but we'll fall back to browser default if it's missing for whatever
+    # reason.
+    lang = body.get('lang', requested_lang())
 
     # For debugging
     print(f"got code {code}")
@@ -109,7 +113,7 @@ def parse():
     # is so, parse
     else:
         try:
-            hedy_errors = TRANSLATIONS.get_translations(requested_lang(), 'HedyErrorMessages')
+            hedy_errors = TRANSLATIONS.get_translations(lang, 'HedyErrorMessages')
             result = hedy.transpile(code, level)
             response["Code"] = "# coding=utf8\n" + result
         except hedy.HedyException as E:
@@ -130,7 +134,7 @@ def parse():
         'session': session_id(),
         'date': str(datetime.datetime.now()),
         'level': level,
-        'lang': requested_lang(),
+        'lang': lang,
         'code': code,
         'server_error': response.get('Error'),
         'version': version(),


Test patch:
Repository: hedyorg/hedy

Issue:
Move explanation & videos to an expandable section within the main code section
- Join videos & explanation into one page.
- Move explanation & videos to an expandable section within the main code section
- Remove second level tabs to switch between views since they're no longer necessary.


Discussion:

Resolving patch:
diff --git a/app.py b/app.py
--- a/app.py
+++ b/app.py
@@ -238,23 +238,6 @@ def index(level, step):
         version=version(),
         loaded_program=loaded_program)
 
-@app.route('/hedy/<level>/<step>/<docspage>', methods=['GET'])
-def docs(level, step, docspage):
-    session_id()
-    g.level = level = int(level)
-    g.lang = lang = requested_lang()
-    g.prefix = '/hedy'
-
-    return hedyweb.render_assignment_docs(
-        doc_type=docspage,
-        course=HEDY_COURSE[lang],
-        level_number=level,
-        # We don't have assignments in this course! (yet)
-        assignment_number=step,
-        menu=render_main_menu('hedy'),
-        translations=TRANSLATIONS)
-
-
 @app.route('/onlinemasters', methods=['GET'], defaults={'level': 1, 'step': 1})
 @app.route('/onlinemasters/<level>', methods=['GET'], defaults={'step': 1})
 @app.route('/onlinemasters/<level>/<step>', methods=['GET'])
diff --git a/hedyweb.py b/hedyweb.py
--- a/hedyweb.py
+++ b/hedyweb.py
@@ -55,38 +55,8 @@ def render_assignment_editor(request, course, level_number, assignment_number, m
   # Actual assignment
   arguments_dict.update(**attr.asdict(assignment))
 
-  return render_template("code-page.html", **arguments_dict)
-
-
-def render_assignment_docs(doc_type, course, level_number, assignment_number, menu, translations):
-  assignment = course.get_assignment(level_number, assignment_number)
-  if not assignment:
-    abort(404)
+  # Add markdowns to docs
+  for doc in arguments_dict ['docs']:
+    doc ['markdown'] = (course.docs.get(int(level_number), doc ['slug']) or {'markdown': ''}).markdown
 
-  arguments_dict = {}
-
-  # Meta stuff
-  arguments_dict['course'] = course
-  arguments_dict['level_nr'] = str(level_number)
-  arguments_dict['assignment_nr'] = assignment.step  # Give this a chance to be 'None'
-  arguments_dict['pagetitle'] = f'Level {level_number} - Hedy'
-  arguments_dict['lang'] = course.language
-  arguments_dict['selected_page'] = doc_type
-  arguments_dict['docs'] = [attr.asdict(d) for d in assignment.docs]
-  arguments_dict['auth'] = translations.data [course.language] ['Auth']
-
-  # Translations
-  arguments_dict.update(**translations.get_translations(course.language, 'ui'))
-
-  doc = course.docs.get(int(level_number), doc_type)
-  if not doc:
-    # Redirect to code page. Nasty 'import' here to work around
-    # cyclic imports.
-    import app
-    return redirect(app.hedy_link(level_number, assignment_number))
-
-  arguments_dict['mkd'] = doc.markdown
-  arguments_dict['menu'] = menu
-  arguments_dict['page_title'] = f'Level {level_number}.{assignment_number} – ' + doc.front_matter.get('title', '') + ' – Hedy'
-
-  return render_template("per-level-text.html", **arguments_dict)
+  return render_template("code-page.html", **arguments_dict)


Test patch:
Repository: hedyorg/hedy

Issue:
Detect Python version and avoid running Hedy if the version is too low
Thanks to @tazaria for pointing this out!


Discussion:

Resolving patch:
diff --git a/app.py b/app.py
--- a/app.py
+++ b/app.py
@@ -1,3 +1,8 @@
+import sys
+if (sys.version_info.major < 4 or sys.version_info.minor < 6):
+    print ('Hedy requires Python 3.6 or newer to run. However, your version of Python is', '.'.join ([str (sys.version_info.major), str (sys.version_info.minor), str (sys.version_info.micro)]))
+    quit ()
+
 # coding=utf-8
 import datetime
 import collections


Test patch:
Repository: hedyorg/hedy

Issue:
Add Italian translations



Discussion:

Resolving patch:
diff --git a/app.py b/app.py
--- a/app.py
+++ b/app.py
@@ -34,6 +34,7 @@
     'fr': 'Français',
     'pt_br': 'Português',
     'de': 'Deutsch',
+    'it': 'Italiano'
 }
 
 LEVEL_DEFAULTS = collections.defaultdict(courses.NoSuchDefaults)


Test patch:
Repository: hedyorg/hedy

Issue:
Add #programs per user 
Can we have the number of programs behind each users (to quickly find interesting users to explore)
Add #programs per user 
Can we have the number of programs behind each users (to quickly find interesting users to explore)


Discussion:

Resolving patch:
diff --git a/app.py b/app.py
--- a/app.py
+++ b/app.py
@@ -436,6 +436,10 @@ def delete_program (user, program_id):
     if not result or result ['username'] != user ['username']:
         return "", 404
     db_del ('programs', {'id': program_id})
+    program_count = 0
+    if 'program_count' in user:
+        program_count = user ['program_count']
+    db_set ('users', {'username': user ['username'], 'program_count': program_count - 1})
     return redirect ('/programs')
 
 @app.route('/programs', methods=['POST'])
@@ -488,6 +492,10 @@ def save_program (user):
         'server_error': error,
         'username': user ['username']
     })
+    program_count = 0
+    if 'program_count' in user:
+        program_count = user ['program_count']
+    db_set('users', {'username': user ['username'], 'program_count': program_count + 1})
 
     return jsonify({})
 
diff --git a/auth.py b/auth.py
--- a/auth.py
+++ b/auth.py
@@ -3,7 +3,7 @@
 import re
 import urllib
 from flask import request, make_response, jsonify, redirect, render_template
-from utils import type_check, object_check, timems, times, db_get, db_set, db_del, db_del_many, db_scan, db_describe
+from utils import type_check, object_check, timems, times, db_get, db_set, db_del, db_del_many, db_scan, db_describe, db_get_many
 import datetime
 from functools import wraps
 from config import config
@@ -479,7 +479,7 @@ def auth_templates (page, lang, menu, request):
         # After hitting 1k users, it'd be wise to add pagination.
         users = db_scan ('users')
         userdata = []
-        fields = ['username', 'email', 'birth_year', 'country', 'gender', 'created', 'last_login', 'verification_pending', 'is_teacher']
+        fields = ['username', 'email', 'birth_year', 'country', 'gender', 'created', 'last_login', 'verification_pending', 'is_teacher', 'program_count']
         for user in users:
             data = {}
             for field in fields:
@@ -501,3 +501,15 @@ def auth_templates (page, lang, menu, request):
             counter = counter + 1
 
         return render_template ('admin.html', users=userdata, program_count=db_describe ('programs') ['Table'] ['ItemCount'], user_count=db_describe ('users') ['Table'] ['ItemCount'])
+
+# Helper method to initialize program count for existing users
+# TODO: Remove after deploying the code
+def initialize_program_count ():
+    users = db_scan ('users')
+    for user in users:
+        programs = db_get_many ('programs', {'username': user ['username']}, True)
+        if len (programs):
+           print ('Updating program count for user', user ['username'], len (programs))
+           db_set ('users', {'username': user ['username'], 'program_count': len (programs)})
+
+initialize_program_count ()


Test patch:
Repository: hedyorg/hedy

Issue:
Sometimes a "server error" HTML page is served with a 200 response code
As discovered in #464, when the internal server error is triggered by submitting a program to parse without supplying a cookie:

```
$ curl 'https://hedy-alpha.herokuapp.com/parse' \
         -H 'Content-Type: application/json' \
         --data-raw '{"level":"1","code":"print hallo wereld\u0021","lang":"nl"}' \
         --compressed -vv

< HTTP/1.1 200 OK
...
<h1>500 Internal Server Error</h1>
```

As you can see, the response is served using a 200 response code. This leads to the error going "undetected" in a bunch of places:

* Not counted in Heroku's dashboard
* Not visible in the router log

Worst of all:

* No exception trace shown in the error log, so no way to debug the error.


Discussion:

Resolving patch:
diff --git a/app.py b/app.py
--- a/app.py
+++ b/app.py
@@ -553,7 +553,7 @@ def error():
 def internal_error(exception):
     import traceback
     print(traceback.format_exc())
-    return "<h1>500 Internal Server Error</h1>"
+    return "<h1>500 Internal Server Error</h1>", 500
 
 @app.route('/index.html')
 @app.route('/')


Test patch: