internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: ocadotechnology/codeforlife-portal

Issue:
Update KS3 AI:MMO User Guide PDF on portal
- The Aim of the Game section has been updated with a clearer definition of how AI:MMO uses artificial intelligence. 
- The Example Code section has been updated as there were errors in the code.

The updated document is here:
[KS3-AIMMO-User-guide.pdf](https://github.com/ocadotechnology/codeforlife-portal/files/1906973/KS3-AIMMO-User-guide.pdf)



Discussion:

Resolving patch:
diff --git a/portal/views/teacher/pdfs.py b/portal/views/teacher/pdfs.py
--- a/portal/views/teacher/pdfs.py
+++ b/portal/views/teacher/pdfs.py
@@ -87,6 +87,14 @@
         "page_origin": "#user-guide"
     },
 
+    "user_guide_aimmo": {
+        "title": "User Guide (AI:MMO)",
+        "description": "User guide for AI:MMO, the KS3 game.",
+        "links": None,
+        "url": "general_resources/KS3-AIMMO-User-guide.pdf",
+        "page_origin": "#user-guide"
+    },
+
     # ...................KS1 sessions...........#
     "ks1_session_1": {
         "title": "KS1 - Session 1",


Test patch:
Repository: ocadotechnology/codeforlife-portal

Issue:
Speak to legal team about updating our T&Cs for GDPR



Discussion:

Resolving patch:
diff --git a/portal/admin.py b/portal/admin.py
--- a/portal/admin.py
+++ b/portal/admin.py
@@ -68,14 +68,14 @@ class TeacherAdmin(admin.ModelAdmin):
 
 
 class UserProfileAdmin(admin.ModelAdmin):
-    search_fields = ['user__first_name', 'user__last_name', 'new_username', 'user__date_joined']
+    search_fields = ['user__first_name', 'user__last_name', 'user__username', 'user__date_joined']
     list_filter = ['user__date_joined']
     list_display = ['user', 'joined_recently']
     readonly_fields = ['user']
 
 
 class EmailVerificationAdmin(admin.ModelAdmin):
-    search_fields = ['new_user']
+    search_fields = ['user__first_name', 'user__last_name', 'user__username', 'user__date_joined']
 
 
 UserAdmin.list_display += ('date_joined',)


Test patch:
Repository: ocadotechnology/codeforlife-portal

Issue:
portal API not working anymore
**Describe the bug**
When trying to access the following URLs:
/api/lastconnectedsince/YYYY/MM/DD
.../registered/YYYY/MM/DD
.../userspercountry/CC
On any of our servers, we get a 500 error.
Google console says: 

> TemplateSyntaxError: 'url' is not a valid tag or filter in tag library 'future'

It happens even with the right to access them.

**To Reproduce**
If you have an authorised google account, go to https://www.codeforlife.education/api/lastconnectedsince/2018/07/20/ and you will see a 500 error

**Expected behaviour**
This page to display a number when your google account is autorised

**Desktop (please complete the following information):**

- OS:Ubuntu 16.04
- Browser:Chrome
 
**Additional context**
The urls.py file has been reworked for forward compatibility


Discussion:

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -10,7 +10,7 @@
           'django==1.9.13',
           'django-appconf==1.0.1',
           'django-countries==3.4.1',
-          'djangorestframework==3.1.3',
+          'djangorestframework==3.2.3',
           'django-jquery==1.9.1',
           'django-autoconfig==0.8.0',
           'django-pipeline==1.5.4',


Test patch:
Repository: ansible-collections/amazon.aws

Issue:
ec2_metadata_facts may fail with ansible-core 2.13+
### Summary

When using ansible-core 2.13+ (ansible 6.0.0+) ec2_metadata_facts may fail.

This occurs when an endpoint (such as http://169.254.169.254/latest/meta-data/public-keys/) is enumerated and results in endpoints that return 404. This occurs for public-keys specifically as the enumeration returns the name of the public key, but the name is not valid as an endpoint - just the ID.

A breaking change in fetch_url (https://github.com/ansible/ansible/blob/devel/docs/docsite/rst/porting_guides/porting_guide_core_2.13.rst) means that URLs that return 404 now result in response.read being None, which results in fact fetching throwing an exception instead of returning None as it did in prior versions of ansible.

### Issue Type

Bug Report

### Component Name

ec2_metadata_facts

### Ansible Version

```console (paste below)
$ ansible --version
```
ansible [core 2.13.2]
  python version = 3.9.13 (main, Jul 20 2022, 13:16:06) [GCC 4.8.5 20150623 (Red Hat 4.8.5044)]
  jinja version = 3.1.2
  libyaml = True


### Collection Versions

```console (paste below)
$ ansible-galaxy collection list
```
amazon.aws 3.3.1

### AWS SDK versions

```console (paste below)
$ pip show boto boto3 botocore
```
boto3 = 1.24.33
botocore = 1.27.33
boto = 2.49.0

### Configuration

```console (paste below)
$ ansible-config dump --only-changed

```


### OS / Environment

RHEL 7

### Steps to Reproduce

<!--- Paste example playbooks or commands between quotes below -->
```yaml (paste below)
- hosts: all
  tasks:
    - ec2_metadata_facts:

```


### Expected Results

Return data successfully!

### Actual Results

```console (paste below)
File ec2_metadata-facts.py, line 481 in _fetch
TypeError: 'NoneType' object is not callable
```


### Code of Conduct

- [X] I agree to follow the Ansible Code of Conduct


Discussion:

Resolving patch:
diff --git a/plugins/modules/ec2_metadata_facts.py b/plugins/modules/ec2_metadata_facts.py
--- a/plugins/modules/ec2_metadata_facts.py
+++ b/plugins/modules/ec2_metadata_facts.py
@@ -477,7 +477,7 @@ def _fetch(self, url):
             if info.get('status') not in (200, 404):
                 # fail out now
                 self.module.fail_json(msg='Failed to retrieve metadata from AWS: {0}'.format(info['msg']), response=info)
-        if response:
+        if response and info['status'] < 400:
             data = response.read()
         else:
             data = None


Test patch:
Repository: ansible-collections/amazon.aws

Issue:
rds_instance state definition refers to snapshots
### Summary

The [documentation for `rds_instance`](https://docs.ansible.com/ansible/latest/collections/amazon/aws/rds_instance_module.html#ansible-collections-amazon-aws-rds-instance-module) says that the `state` parameter means:

> Whether the snapshot should exist or not. 

That doesn't sound right. Was this just a typo when someone was copy-pasting the docs for each parameter?

The remainder of the explanation, the parameter name, and the parameter values do not sound related to snapshots.

if `state` = `absent` or `terminated`, then whether or not you create a snapshot is relevant, but isn't that what `skip_final_snapshot` is for?

### Issue Type

Documentation Report

### Component Name

rds_instance

### Ansible Version

n/a

### Collection Versions

n/a

### Configuration

n/a

### OS / Environment

n/a

### Additional Information

_No response_

### Code of Conduct

- [X] I agree to follow the Ansible Code of Conduct


Discussion:
@mdavis-xyz Thank you for raising this issue. I guess there's a copy/paste mismatch. Would you be willing to open a pull request with a fix for the documentation?

Resolving patch:
diff --git a/plugins/modules/rds_instance.py b/plugins/modules/rds_instance.py
--- a/plugins/modules/rds_instance.py
+++ b/plugins/modules/rds_instance.py
@@ -24,11 +24,11 @@
   # General module options
     state:
         description:
-          - Whether the snapshot should exist or not. I(rebooted) is not idempotent and will leave the DB instance in a running state
+          - Desired state of the RDS Instance.
+          - I(state=rebooted) is not idempotent and will leave the DB instance in a running state
             and start it prior to rebooting if it was stopped. I(present) will leave the DB instance in the current running/stopped state,
             (running if creating the DB instance).
-          - I(state=running) and I(state=started) are synonyms, as are I(state=rebooted) and I(state=restarted). Note - rebooting the instance
-            is not idempotent.
+          - I(state=running) and I(state=started) are synonyms, as are I(state=rebooted) and I(state=restarted).
         choices: ['present', 'absent', 'terminated', 'running', 'started', 'stopped', 'rebooted', 'restarted']
         default: 'present'
         type: str


Test patch:
Repository: ansible-collections/amazon.aws

Issue:
rds_instance state definition refers to snapshots
### Summary

The [documentation for `rds_instance`](https://docs.ansible.com/ansible/latest/collections/amazon/aws/rds_instance_module.html#ansible-collections-amazon-aws-rds-instance-module) says that the `state` parameter means:

> Whether the snapshot should exist or not. 

That doesn't sound right. Was this just a typo when someone was copy-pasting the docs for each parameter?

The remainder of the explanation, the parameter name, and the parameter values do not sound related to snapshots.

if `state` = `absent` or `terminated`, then whether or not you create a snapshot is relevant, but isn't that what `skip_final_snapshot` is for?

### Issue Type

Documentation Report

### Component Name

rds_instance

### Ansible Version

n/a

### Collection Versions

n/a

### Configuration

n/a

### OS / Environment

n/a

### Additional Information

_No response_

### Code of Conduct

- [X] I agree to follow the Ansible Code of Conduct


Discussion:
@mdavis-xyz Thank you for raising this issue. I guess there's a copy/paste mismatch. Would you be willing to open a pull request with a fix for the documentation?

Resolving patch:
diff --git a/plugins/modules/rds_instance.py b/plugins/modules/rds_instance.py
--- a/plugins/modules/rds_instance.py
+++ b/plugins/modules/rds_instance.py
@@ -26,11 +26,11 @@
   # General module options
     state:
         description:
-          - Whether the snapshot should exist or not. I(rebooted) is not idempotent and will leave the DB instance in a running state
+          - Desired state of the RDS Instance.
+          - I(state=rebooted) is not idempotent and will leave the DB instance in a running state
             and start it prior to rebooting if it was stopped. I(present) will leave the DB instance in the current running/stopped state,
             (running if creating the DB instance).
-          - I(state=running) and I(state=started) are synonyms, as are I(state=rebooted) and I(state=restarted). Note - rebooting the instance
-            is not idempotent.
+          - I(state=running) and I(state=started) are synonyms, as are I(state=rebooted) and I(state=restarted).
         choices: ['present', 'absent', 'terminated', 'running', 'started', 'stopped', 'rebooted', 'restarted']
         default: 'present'
         type: str


Test patch:
Repository: ansible-collections/amazon.aws

Issue:
`host` option in tenancy under placement
### Summary

AWS has three type of options on tenancy: Shared, Dedicated, Dedicated Host.
If we use a dedicated host with `auto-placement` option, we can allocate a machine to untargeted a dedicated host.
We should set tenancy to `dedicated host` to use this function.

`ec2_instance` module already have shared and dedicated (`default` and `dedicated`) options.
I think it should have a dedicated host (`host`) option as well.

https://github.com/ansible-collections/amazon.aws/blob/main/plugins/modules/ec2_instance.py#L258-L262


### Issue Type

Feature Idea

### Component Name

ec2_instance

### Additional Information

<!--- Paste example playbooks or commands between quotes below -->
```yaml (paste below)

```


### Code of Conduct

- [X] I agree to follow the Ansible Code of Conduct


Discussion:

Resolving patch:
diff --git a/plugins/modules/ec2_instance.py b/plugins/modules/ec2_instance.py
--- a/plugins/modules/ec2_instance.py
+++ b/plugins/modules/ec2_instance.py
@@ -359,10 +359,12 @@
         type: int
         required: false
       tenancy:
-        description: Type of tenancy to allow an instance to use. Default is shared tenancy. Dedicated tenancy will incur additional charges.
+        description:
+          - Type of tenancy to allow an instance to use. Default is shared tenancy. Dedicated tenancy will incur additional charges.
+          - Support for I(tenancy=host) was added in amazon.aws 7.6.0.
         type: str
         required: false
-        choices: ['dedicated', 'default']
+        choices: ['dedicated', 'default', 'host']
   license_specifications:
     description:
       - The license specifications to be used for the instance.
@@ -2304,7 +2306,7 @@ def main():
                 host_id=dict(type="str"),
                 host_resource_group_arn=dict(type="str"),
                 partition_number=dict(type="int"),
-                tenancy=dict(type="str", choices=["dedicated", "default"]),
+                tenancy=dict(type="str", choices=["dedicated", "default", "host"]),
             ),
         ),
         instance_initiated_shutdown_behavior=dict(type="str", choices=["stop", "terminate"]),


Test patch:
Repository: ansible-collections/amazon.aws

Issue:
`host` option in tenancy under placement
### Summary

AWS has three type of options on tenancy: Shared, Dedicated, Dedicated Host.
If we use a dedicated host with `auto-placement` option, we can allocate a machine to untargeted a dedicated host.
We should set tenancy to `dedicated host` to use this function.

`ec2_instance` module already have shared and dedicated (`default` and `dedicated`) options.
I think it should have a dedicated host (`host`) option as well.

https://github.com/ansible-collections/amazon.aws/blob/main/plugins/modules/ec2_instance.py#L258-L262


### Issue Type

Feature Idea

### Component Name

ec2_instance

### Additional Information

<!--- Paste example playbooks or commands between quotes below -->
```yaml (paste below)

```


### Code of Conduct

- [X] I agree to follow the Ansible Code of Conduct


Discussion:

Resolving patch:
diff --git a/plugins/modules/ec2_instance.py b/plugins/modules/ec2_instance.py
--- a/plugins/modules/ec2_instance.py
+++ b/plugins/modules/ec2_instance.py
@@ -359,10 +359,12 @@
         type: int
         required: false
       tenancy:
-        description: Type of tenancy to allow an instance to use. Default is shared tenancy. Dedicated tenancy will incur additional charges.
+        description:
+          - Type of tenancy to allow an instance to use. Default is shared tenancy. Dedicated tenancy will incur additional charges.
+          - Support for I(tenancy=host) was added in amazon.aws 7.6.0.
         type: str
         required: false
-        choices: ['dedicated', 'default']
+        choices: ['dedicated', 'default', 'host']
   license_specifications:
     description:
       - The license specifications to be used for the instance.
@@ -2307,7 +2309,7 @@ def main():
                 host_id=dict(type="str"),
                 host_resource_group_arn=dict(type="str"),
                 partition_number=dict(type="int"),
-                tenancy=dict(type="str", choices=["dedicated", "default"]),
+                tenancy=dict(type="str", choices=["dedicated", "default", "host"]),
             ),
         ),
         instance_initiated_shutdown_behavior=dict(type="str", choices=["stop", "terminate"]),


Test patch:
Repository: dynaconf/dynaconf

Issue:
ModuleNotFoundError: No module named 'flask'
Dynaconf requires Flask by default, is that by mistake or is it intentionally?

```bash
 File "/app/.heroku/python/lib/python3.6/site-packages/dynaconf/__init__.py", line 5, in <module>        
   from dynaconf.contrib import FlaskDynaconf        
 File "/app/.heroku/python/lib/python3.6/site-packages/dynaconf/contrib/__init__.py", line 1, in <module>        
   from dynaconf.contrib.flask_dynaconf import FlaskDynaconf, DynaconfConfig  # noqa        
 File "/app/.heroku/python/lib/python3.6/site-packages/dynaconf/contrib/flask_dynaconf.py", line 2, in <module>        
   from flask.config import Config        
ModuleNotFoundError: No module named 'flask'
```


Discussion:
Should not require Flask by default

Resolving patch:
diff --git a/dynaconf/contrib/flask_dynaconf.py b/dynaconf/contrib/flask_dynaconf.py
--- a/dynaconf/contrib/flask_dynaconf.py
+++ b/dynaconf/contrib/flask_dynaconf.py
@@ -1,5 +1,12 @@
 # coding: utf-8
-from flask.config import Config
+try:
+    from flask.config import Config
+    flask_installed = True
+except ImportError:
+    flask_installed = False
+    Config = object
+
+
 from dynaconf import LazySettings
 
 
@@ -82,6 +89,11 @@ class FlaskDynaconf(object):
     def __init__(self, app=None, instance_relative_config=False,
                  dynaconf_instance=None, **kwargs):
         """kwargs holds initial dynaconf configuration"""
+        if not flask_installed:
+            raise RuntimeError(
+                "To use this extension Flask must be installed "
+                "install it with: pip install flask"
+            )
         self.kwargs = kwargs
         if 'DYNACONF_NAMESPACE' not in kwargs:
             kwargs['DYNACONF_NAMESPACE'] = 'FLASK'


Test patch:
Repository: dynaconf/dynaconf

Issue:
[RFC] dynaconf list command should not show internal variables
**Is your feature request related to a problem? Please describe.**

When I run `dynaconf list` command line it shows all the variables I defined on my `settings.toml` file but it also shows dynaconf internal variables like `ENV_FOR_DYNACONF`, `RENAMED_VARS`, `ENVVAR_PREFIX` etc...

**Describe the solution you'd like**
I would like it by default to show only user defined settings when I run `dynaconf list` and the internal variables will show only if I pass `--all|-a` as in `dynaconf list -a`





Discussion:

Resolving patch:
diff --git a/dynaconf/cli.py b/dynaconf/cli.py
--- a/dynaconf/cli.py
+++ b/dynaconf/cli.py
@@ -364,8 +364,18 @@ def init(fileformat, path, env, _vars, _secrets, wg, y, django):
     default=None,
     help="a loader identifier to filter e.g: toml|yaml",
 )
-def _list(env, key, more, loader):
-    """Lists all defined config values"""
+@click.option(
+    "--all",
+    "_all",
+    "-a",
+    default=False,
+    is_flag=True,
+    help="show dynaconf internal settings?",
+)
+def _list(env, key, more, loader, _all=False):
+    """Lists all user defined config values
+    and if `--all` is passed it also shows dynaconf internal variables.
+    """
     if env:
         env = env.strip()
     if key:
@@ -397,6 +407,11 @@ def _list(env, key, more, loader):
     # remove to avoid displaying twice
     data.pop("SETTINGS_MODULE", None)
 
+    # if not --all remove internal settings
+    if not _all:
+        for name in dir(default_settings):
+            data.pop(name, None)
+
     def color(_k):
         if _k in dir(default_settings):
             return "blue"


Test patch:
diff --git a/tests/test_cli.py b/tests/test_cli.py
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -83,9 +83,18 @@ def test_init_with_path(fileformat, tmpdir):
 
 
 def test_list(testdir):
+    """Test list command shows only user defined vars"""
 
     result = run(["list"], env={"ROOT_PATH_FOR_DYNACONF": testdir})
     assert "DOTENV_STR: 'hello'" in result
+    assert "GLOBAL_ENV_FOR_DYNACONF: 'DYNACONF'" not in result
+
+
+def test_list_with_all(testdir):
+    """Test list command with --all includes interval vars"""
+    result = run(["list", "-a"], env={"ROOT_PATH_FOR_DYNACONF": testdir})
+    assert "DOTENV_STR: 'hello'" in result
+    assert "GLOBAL_ENV_FOR_DYNACONF: 'DYNACONF'" in result
 
 
 @pytest.mark.parametrize("loader", WRITERS)
Repository: dynaconf/dynaconf

Issue:
[bug] RuntimeError: dictionary changed size during iteration when using @del within dynaconf_merge logic
**Describe the bug**
The following [line](https://github.com/rochacbruno/dynaconf/blob/25fed5dc27d1dd78c368d7464f7d160b46aa1d24/dynaconf/utils/__init__.py#L49
) is bugged, changing dict size during iteration, via pop() leads to 

```
RuntimeError: dictionary changed size during iteration
```

**To Reproduce**
You can run following python code which is assumed to be very simple interpretation of the code line above:
```
new = {"a": 1}

for k, v in new.items():
    new.pop(k, None)
```

1. To reproduce it with `dynaconf`, use following config.yaml
```
default:
  options:
    A: 1
    B: 2
development:
  options:
    dynaconf_merge:
      B: "@del"
```

**Expected behavior**
No RuntimeError, key marked with `@del` is removed from merge result



Discussion:

Resolving patch:
diff --git a/dynaconf/utils/__init__.py b/dynaconf/utils/__init__.py
--- a/dynaconf/utils/__init__.py
+++ b/dynaconf/utils/__init__.py
@@ -40,7 +40,7 @@ def object_merge(old, new, unique=False):
                 object_merge(value, new[key])
 
         # Cleanup of MetaValues on New dict
-        for key, value in new.items():
+        for key, value in list(new.items()):
             if getattr(new[key], "dynaconf_reset", False):
                 # new Reset triggers cleanup of existing data
                 new[key] = new[key].value


Test patch:
diff --git a/tests/test_utils.py b/tests/test_utils.py
--- a/tests/test_utils.py
+++ b/tests/test_utils.py
@@ -165,6 +165,16 @@ def test_merge_existing_dict():
     assert new == {"host": "localhost", "port": 666, "user": "admin"}
 
 
+def test_merge_dict_with_meta_values():
+    existing = {"A": 1, "B": 2, "C": 3}
+    new = {
+        "B": parse_conf_data("@del", tomlfy=True),
+        "C": parse_conf_data("@reset 4", tomlfy=True),
+    }
+    object_merge(existing, new)
+    assert new == {"A": 1, "C": 4}
+
+
 def test_trimmed_split():
     # No sep
     assert trimmed_split("hello") == ["hello"]
Repository: dynaconf/dynaconf

Issue:
[RFC] Include data type in cli.list
If I do 

```
export DYNACONF_DAY="@int 28"
```
Now I can list the values
```
dynaconf on  master [$] via 🐍 v3.7.0(dynaconf) 
❯ dynaconf list                
Working in development environment 
USERNAME: 'RiverFount'
DAY: 28
```
But the list is missing the data type.


What I want instead is:

```
dynaconf on  master [$] via 🐍 v3.7.0(dynaconf) 
❯ dynaconf list                
Working in development environment 
USERNAME: (str) 'RiverFount' 
DAY: (int) 28
```
[RFC] Include data type in cli.list
If I do 

```
export DYNACONF_DAY="@int 28"
```
Now I can list the values
```
dynaconf on  master [$] via 🐍 v3.7.0(dynaconf) 
❯ dynaconf list                
Working in development environment 
USERNAME: 'RiverFount'
DAY: 28
```
But the list is missing the data type.


What I want instead is:

```
dynaconf on  master [$] via 🐍 v3.7.0(dynaconf) 
❯ dynaconf list                
Working in development environment 
USERNAME: (str) 'RiverFount' 
DAY: (int) 28
```


Discussion:
https://github.com/rochacbruno/dynaconf/blob/fd9622dd46a5261c243f29eadb43d997f17e408e/dynaconf/cli.py#L431-L436
https://github.com/rochacbruno/dynaconf/blob/fd9622dd46a5261c243f29eadb43d997f17e408e/dynaconf/cli.py#L431-L436

Resolving patch:
diff --git a/dynaconf/cli.py b/dynaconf/cli.py
--- a/dynaconf/cli.py
+++ b/dynaconf/cli.py
@@ -430,7 +430,10 @@ def color(_k):
     if not key:
         datalines = "\n".join(
             "%s: %s"
-            % (click.style(k, bg=color(k), fg="white"), pprint.pformat(v))
+            % (
+                click.style(k, bg=color(k), fg="white"),
+                pprint.pformat("{} -> {}".format(type(v).__name__, v)),
+            )
             for k, v in data.items()
         )
         (click.echo_via_pager if more else click.echo)(datalines)


Test patch: