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

Issue:
Scope "bug"
## Description of the problem, including code/CLI snippet
I am using the list method of project.issues to list issues with certain label. I am searching issue having "vulcheck" as label. In my project I have one issue with "vulcheck" label

```python
def issue_by_project_label(self):
    print(self._project.issues.list(labels="vulcheck"))
```

## Expected Behavior
It should return me the issues with label "vulcheck". I have one issue with label "vulcheck".

## Actual Behavior
It is returning empty list


## Specifications

  - python-gitlab version: 2.1.2
  - API version you are using (v3/v4): v4
  - Gitlab server version (or gitlab.com): 12.6.6-ee



Discussion:

Resolving patch:
diff --git a/gitlab/types.py b/gitlab/types.py
--- a/gitlab/types.py
+++ b/gitlab/types.py
@@ -38,6 +38,10 @@ def set_from_cli(self, cli_value):
             self._value = [item.strip() for item in cli_value.split(",")]
 
     def get_for_api(self):
+        # Do not comma-split single value passed as string
+        if isinstance(self._value, str):
+            return self._value
+
         return ",".join(self._value)
 
 


Test patch:
diff --git a/gitlab/tests/test_types.py b/gitlab/tests/test_types.py
--- a/gitlab/tests/test_types.py
+++ b/gitlab/tests/test_types.py
@@ -51,11 +51,19 @@ def test_empty_input(self):
         o.set_from_cli("  ")
         self.assertEqual([], o.get())
 
-    def test_get_for_api(self):
+    def test_get_for_api_from_cli(self):
         o = types.ListAttribute()
         o.set_from_cli("foo,bar,baz")
         self.assertEqual("foo,bar,baz", o.get_for_api())
 
+    def test_get_for_api_from_list(self):
+        o = types.ListAttribute(["foo", "bar", "baz"])
+        self.assertEqual("foo,bar,baz", o.get_for_api())
+
+    def test_get_for_api_does_not_split_string(self):
+        o = types.ListAttribute("foo")
+        self.assertEqual("foo", o.get_for_api())
+
 
 class TestLowercaseStringAttribute(unittest.TestCase):
     def test_get_for_api(self):
diff --git a/tools/python_test_v4.py b/tools/python_test_v4.py
--- a/tools/python_test_v4.py
+++ b/tools/python_test_v4.py
@@ -677,10 +677,17 @@
 assert type(issue1.closed_by()) == list
 assert type(issue1.related_merge_requests()) == list
 
-# issues labels and events
+# issue labels
 label2 = admin_project.labels.create({"name": "label2", "color": "#aabbcc"})
 issue1.labels = ["label2"]
 issue1.save()
+
+assert issue1 in admin_project.issues.list(labels=["label2"])
+assert issue1 in admin_project.issues.list(labels="label2")
+assert issue1 in admin_project.issues.list(labels="Any")
+assert issue1 not in admin_project.issues.list(labels="None")
+
+# issue events
 events = issue1.resourcelabelevents.list()
 assert events
 event = issue1.resourcelabelevents.get(events[0].id)
Repository: python-gitlab/python-gitlab

Issue:
Duplicated code in gitlab/config.py
## Description of the problem, including code/CLI snippet
Duplicated code found in gitlab/config.py . I think one should be get from 'global'.
```python
        self.http_username = None
        self.http_password = None
        try:
            self.http_username = self._config.get(self.gitlab_id, "http_username")
            self.http_password = self._config.get(self.gitlab_id, "http_password")
        except Exception:
            pass

        self.http_username = None
        self.http_password = None
        try:
            self.http_username = self._config.get(self.gitlab_id, "http_username")
            self.http_password = self._config.get(self.gitlab_id, "http_password")
        except Exception:
            pass
```

## Expected Behavior


## Actual Behavior


## Specifications

  - python-gitlab version: python-gitlab==2.2.0
  - API version you are using (v3/v4): v4
  - Gitlab server version (or gitlab.com): 



Discussion:
I will take a look soon.

Resolving patch:
diff --git a/gitlab/config.py b/gitlab/config.py
--- a/gitlab/config.py
+++ b/gitlab/config.py
@@ -145,14 +145,6 @@ def __init__(self, gitlab_id=None, config_files=None):
         except Exception:
             pass
 
-        self.http_username = None
-        self.http_password = None
-        try:
-            self.http_username = self._config.get(self.gitlab_id, "http_username")
-            self.http_password = self._config.get(self.gitlab_id, "http_password")
-        except Exception:
-            pass
-
         self.api_version = "4"
         try:
             self.api_version = self._config.get("global", "api_version")


Test patch:
Repository: python-gitlab/python-gitlab

Issue:
access_level is missing when RunnerManager creates a runner object
## Description of the problem, including code/CLI snippet
`access_level` is missing when RunnerManager creates a runner object, but exists in arguments of `update()`. So we have 
 to manually update the `access_level` after creating.

## Expected Behavior
pass `access_level` on creating

## Actual Behavior
can not pass `access_level`

## Specifications

  - python-gitlab version: all
  - API version you are using (v3/v4): v4
  - Gitlab server version (or gitlab.com): >=10.0



Discussion:

Resolving patch:
diff --git a/gitlab/v4/objects/__init__.py b/gitlab/v4/objects/__init__.py
--- a/gitlab/v4/objects/__init__.py
+++ b/gitlab/v4/objects/__init__.py
@@ -5490,6 +5490,7 @@ class RunnerManager(CRUDMixin, RESTManager):
             "locked",
             "run_untagged",
             "tag_list",
+            "access_level",
             "maximum_timeout",
         ),
     )


Test patch:
Repository: python-gitlab/python-gitlab

Issue:
Trigger export using CLI
I would love to be able to trigger project exports using the CLI.

I'm fine with the export notification going to my e-mail and me downloading them from there if I can just automate half of it.


Discussion:
You can do this:

```shell
gitlab project-export create --project-id 1234
# wait for export 
gitlab project-export download --project-id 1234 > export.tar.gz
```

Just missing some docs on this. We'd also need to fix the CLI subcommands so we can check for export status. :)

Resolving patch:
diff --git a/docs/conf.py b/docs/conf.py
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -39,7 +39,12 @@
 # Add any Sphinx extension module names here, as strings. They can be
 # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
 # ones.
-extensions = ["sphinx.ext.autodoc", "sphinx.ext.autosummary", "ext.docstrings"]
+extensions = [
+    "sphinx.ext.autodoc",
+    "sphinx.ext.autosummary",
+    "ext.docstrings",
+    "sphinxcontrib.autoprogram",
+]
 
 # Add any paths that contain templates here, relative to this directory.
 templates_path = ["_templates"]
diff --git a/gitlab/cli.py b/gitlab/cli.py
--- a/gitlab/cli.py
+++ b/gitlab/cli.py
@@ -149,6 +149,20 @@ def _parse_value(v):
     return v
 
 
+def docs():
+    """
+    Provide a statically generated parser for sphinx only, so we don't need
+    to provide dummy gitlab config for readthedocs.
+    """
+    if "sphinx" not in sys.modules:
+        sys.exit("Docs parser is only intended for build_sphinx")
+
+    parser = _get_base_parser(add_help=False)
+    cli_module = importlib.import_module("gitlab.v4.cli")
+
+    return _get_parser(cli_module)
+
+
 def main():
     if "--version" in sys.argv:
         print(gitlab.__version__)


Test patch:
Repository: python-gitlab/python-gitlab

Issue:
Missing API code owner approval for protected branches
## Summary

The branch manager is missing an attribute implementation of `code_owner_approval_required` as documented in [GitLab API documentation](https://docs.gitlab.com/ce/api/protected_branches.html#protect-repository-branches)

## Expected Behavior

`ProjectProtectedBranchManager.code_owner_approval_required` should be implemented to mirror the API as documented:

Attribute | Type | Required | Description
-- | -- | -- | --
code_owner_approval_required | boolean | no | Prevent pushes to this branch if it matches an item in the CODEOWNERS file. (defaults: false)

## Actual Behavior

`code_owner_approval_required` is not available as attribute in `ProjectProtectedBranchManager`.



Discussion:

Resolving patch:
diff --git a/gitlab/v4/objects/branches.py b/gitlab/v4/objects/branches.py
--- a/gitlab/v4/objects/branches.py
+++ b/gitlab/v4/objects/branches.py
@@ -84,5 +84,6 @@ class ProjectProtectedBranchManager(NoUpdateMixin, RESTManager):
             "allowed_to_push",
             "allowed_to_merge",
             "allowed_to_unprotect",
+            "code_owner_approval_required",
         ),
     )


Test patch:
Repository: python-gitlab/python-gitlab

Issue:
Feature Request: Support Milestone Promotion
## Description of the problem, including code/CLI snippet
This request is for supporting the ability to 'promote' a project milestone to a group one. This exists in the Gitlab API.

Specifically, https://docs.gitlab.com/ee/api/milestones.html#promote-project-milestone-to-a-group-milestone

## Expected Behavior

`project.milestones.promote(milestone_id)`

## Actual Behavior

Promotion not supported

## Specifications

  - python-gitlab version: latest
  - API version you are using (v3/v4): v4
  - Gitlab server version (or gitlab.com): Any



Discussion:
I'd like to work on this issue - if you could assign it to me, that'd be great!

Resolving patch:
diff --git a/gitlab/v4/objects/milestones.py b/gitlab/v4/objects/milestones.py
--- a/gitlab/v4/objects/milestones.py
+++ b/gitlab/v4/objects/milestones.py
@@ -2,7 +2,7 @@
 from gitlab import exceptions as exc
 from gitlab import types
 from gitlab.base import RequiredOptional, RESTManager, RESTObject, RESTObjectList
-from gitlab.mixins import CRUDMixin, ObjectDeleteMixin, SaveMixin
+from gitlab.mixins import CRUDMixin, ObjectDeleteMixin, PromoteMixin, SaveMixin
 
 from .issues import GroupIssue, GroupIssueManager, ProjectIssue, ProjectIssueManager
 from .merge_requests import (
@@ -90,8 +90,9 @@ class GroupMilestoneManager(CRUDMixin, RESTManager):
     _types = {"iids": types.ListAttribute}
 
 
-class ProjectMilestone(SaveMixin, ObjectDeleteMixin, RESTObject):
+class ProjectMilestone(PromoteMixin, SaveMixin, ObjectDeleteMixin, RESTObject):
     _short_print_attr = "title"
+    _update_uses_post = True
 
     @cli.register_custom_action("ProjectMilestone")
     @exc.on_http_error(exc.GitlabListError)


Test patch:
diff --git a/tests/functional/api/test_projects.py b/tests/functional/api/test_projects.py
--- a/tests/functional/api/test_projects.py
+++ b/tests/functional/api/test_projects.py
@@ -199,6 +199,27 @@ def test_project_milestones(project):
     assert len(milestone.merge_requests()) == 0
 
 
+def test_project_milestone_promotion(gl, group):
+    """
+    Milestone promotion requires the project to be a child of a group (not in a user namespace)
+
+    """
+    _id = uuid.uuid4().hex
+    data = {
+        "name": f"test-project-{_id}",
+        "namespace_id": group.id,
+    }
+    project = gl.projects.create(data)
+
+    milestone_title = "promoteme"
+    promoted_milestone = project.milestones.create({"title": milestone_title})
+    promoted_milestone.promote()
+
+    assert any(
+        milestone.title == milestone_title for milestone in group.milestones.list()
+    )
+
+
 def test_project_pages_domains(gl, project):
     domain = project.pagesdomains.create({"domain": "foo.domain.com"})
     assert len(project.pagesdomains.list()) == 1
Repository: python-gitlab/python-gitlab

Issue:
RFE: Add support for listing a project's groups
We currently don't seem to have support for the API endpoint:
https://docs.gitlab.com/ee/api/projects.html#list-a-projects-groups

We should add support for this in `gitlab/v4/objects/projects.py`


Discussion:

Resolving patch:
diff --git a/gitlab/v4/objects/projects.py b/gitlab/v4/objects/projects.py
--- a/gitlab/v4/objects/projects.py
+++ b/gitlab/v4/objects/projects.py
@@ -109,6 +109,24 @@ class GroupProjectManager(ListMixin, RESTManager):
     )
 
 
+class ProjectGroup(RESTObject):
+    pass
+
+
+class ProjectGroupManager(ListMixin, RESTManager):
+    _path = "/projects/{project_id}/groups"
+    _obj_cls = ProjectGroup
+    _from_parent_attrs = {"project_id": "id"}
+    _list_filters = (
+        "search",
+        "skip_groups",
+        "with_shared",
+        "shared_min_access_level",
+        "shared_visible_only",
+    )
+    _types = {"skip_groups": types.ListAttribute}
+
+
 class Project(RefreshMixin, SaveMixin, ObjectDeleteMixin, RepositoryMixin, RESTObject):
     _short_print_attr = "path"
 
@@ -132,6 +150,7 @@ class Project(RefreshMixin, SaveMixin, ObjectDeleteMixin, RepositoryMixin, RESTO
     files: ProjectFileManager
     forks: "ProjectForkManager"
     generic_packages: GenericPackageManager
+    groups: ProjectGroupManager
     hooks: ProjectHookManager
     imports: ProjectImportManager
     issues: ProjectIssueManager


Test patch:
diff --git a/tests/functional/api/test_projects.py b/tests/functional/api/test_projects.py
--- a/tests/functional/api/test_projects.py
+++ b/tests/functional/api/test_projects.py
@@ -311,3 +311,21 @@ def test_project_wiki(project):
     wiki.save()
     wiki.delete()
     assert len(project.wikis.list()) == 0
+
+
+def test_project_groups_list(gl, group):
+    """Test listing groups of a project"""
+    # Create a subgroup of our top-group, we will place our new project inside
+    # this group.
+    group2 = gl.groups.create(
+        {"name": "group2_proj", "path": "group2_proj", "parent_id": group.id}
+    )
+    data = {
+        "name": "test-project-tpsg",
+        "namespace_id": group2.id,
+    }
+    project = gl.projects.create(data)
+
+    groups = project.groups.list()
+    group_ids = set([x.id for x in groups])
+    assert set((group.id, group2.id)) == group_ids
Repository: python-gitlab/python-gitlab

Issue:
Epic notes list returns 404 error
Tried using epic.notes.list() but it's returning 404 error, this matches the behavior described in https://docs.gitlab.com/ee/api/notes.html#list-all-epic-notes when **epic IID** is used.

So guessing these need to change to epic ID instead?
https://github.com/python-gitlab/python-gitlab/blob/3f91d2455657c570851f625c0d80c685d9393cbb/gitlab/v4/objects/notes.py#L52
https://github.com/python-gitlab/python-gitlab/blob/3f91d2455657c570851f625c0d80c685d9393cbb/gitlab/v4/objects/notes.py#L54


Discussion:
Thanks for the catch @jacche that seems correct. That's...strange, I don't really understand the rationale for that in the upstream API :)
Yes, changing the parent attributes should be enough, would you like to open a PR yourself?
Thanks for validating @nejch , I'm new here so not too sure about the process, but this seems like a good one to get started :-) I'll open a PR myself then.
cheers
Thanks @jacche just read the contributing guide to get some tips when the linters start to complain. If you have `tox` installed, just run `tox` after committing and before pushing and it will run all the basic checks :)

Resolving patch:
diff --git a/gitlab/v4/objects/notes.py b/gitlab/v4/objects/notes.py
--- a/gitlab/v4/objects/notes.py
+++ b/gitlab/v4/objects/notes.py
@@ -49,9 +49,9 @@ class GroupEpicNote(SaveMixin, ObjectDeleteMixin, RESTObject):
 
 
 class GroupEpicNoteManager(CRUDMixin, RESTManager):
-    _path = "/groups/{group_id}/epics/{epic_iid}/notes"
+    _path = "/groups/{group_id}/epics/{epic_id}/notes"
     _obj_cls = GroupEpicNote
-    _from_parent_attrs = {"group_id": "group_id", "epic_iid": "iid"}
+    _from_parent_attrs = {"group_id": "group_id", "epic_id": "id"}
     _create_attrs = RequiredOptional(required=("body",), optional=("created_at",))
     _update_attrs = RequiredOptional(required=("body",))
 
@@ -68,11 +68,11 @@ class GroupEpicDiscussionNote(SaveMixin, ObjectDeleteMixin, RESTObject):
 class GroupEpicDiscussionNoteManager(
     GetMixin, CreateMixin, UpdateMixin, DeleteMixin, RESTManager
 ):
-    _path = "/groups/{group_id}/epics/{epic_iid}/discussions/{discussion_id}/notes"
+    _path = "/groups/{group_id}/epics/{epic_id}/discussions/{discussion_id}/notes"
     _obj_cls = GroupEpicDiscussionNote
     _from_parent_attrs = {
         "group_id": "group_id",
-        "epic_iid": "epic_iid",
+        "epic_id": "epic_id",
         "discussion_id": "id",
     }
     _create_attrs = RequiredOptional(required=("body",), optional=("created_at",))


Test patch:
diff --git a/tests/functional/ee-test.py b/tests/functional/ee-test.py
--- a/tests/functional/ee-test.py
+++ b/tests/functional/ee-test.py
@@ -8,6 +8,7 @@
 I_P1 = 1
 I_P2 = 1
 EPIC_ISSUES = [4, 5]
+EPIC_NOTES = ["rubeus", "hagrid"]
 G1 = "group1"
 LDAP_CN = "app1"
 LDAP_PROVIDER = "ldapmain"
@@ -154,5 +155,11 @@ def end_log():
 for ei in epic.issues.list():
     ei.delete()
 
+# epic notes
+assert not epic.notes.list()
+for i in EPIC_NOTES:
+    epic.notes.create({"body": i})
+assert len(EPIC_NOTES == len(epic.notes.list()))
+
 epic.delete()
 end_log()
Repository: python-gitlab/python-gitlab

Issue:
Expose call to change the default MR target project on the CLI
## Description of the problem, including code/CLI snippet

Since [GitLab 13.11](https://gitlab.com/gitlab-org/gitlab/-/blob/v13.11.0-ee/doc/user/project/merge_requests/creating_merge_requests.md#new-merge-request-from-a-fork) it is possible to change the default target project for a merge request in a non-private forked project ([#58093](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/58093)) and documented in [v14.7](https://gitlab.com/gitlab-org/gitlab/-/blob/v14.7.0-ee/doc/api/projects.md#get-single-project) (look for `mr_default_target_self`).

I have not been able to find a way to do it with the CLI; but it works fine with:

```python
project = gl.projects.get(project_id)
project.mr_default_target_self = True
project.save()
```

## Expected Behavior

Be able to use the CLI to set the target; i.e.: `gitlab project update --merge-requests-default-target <self | upstream>` or `gitlab project update --merge-requests-default-target-self <true | false>`.

## Actual Behavior

Not available?

## Specifications

  - python-gitlab version: 3.11.0
  - API version you are using (v3/v4): v4
  - Gitlab server version (or gitlab.com): 14.10.5-ee and GitLab.com



Discussion:
Hey @romain-dartigues thanks for the report!

Currently, we don't accept arbitrary CLI arguments so we have to explicitly define them in code. It just needs to be added here:

https://github.com/python-gitlab/python-gitlab/blob/892281e35e3d81c9e43ff6a974f920daa83ea8b2/gitlab/v4/objects/projects.py#L704-L773

Would you be interested in opening a small PR for this? :)

Resolving patch:
diff --git a/gitlab/v4/objects/projects.py b/gitlab/v4/objects/projects.py
--- a/gitlab/v4/objects/projects.py
+++ b/gitlab/v4/objects/projects.py
@@ -740,6 +740,7 @@ class ProjectManager(CRUDMixin, RESTManager):
             "mirror_trigger_builds",
             "mirror_user_id",
             "mirror",
+            "mr_default_target_self",
             "name",
             "operations_access_level",
             "only_allow_merge_if_all_discussions_are_resolved",


Test patch:
Repository: python-gitlab/python-gitlab

Issue:
project iterations are broken
project objects are using the `GroupIterationManager` instead of the `ProjectIterationManager` resulting in a `404 Group Not Found` error received from the server when no project ID matches a group ID. I haven't come across it, but I could see this returning the matching group IDs iterations instead of the project ID's iterations if a matching group ID were to exist.


Discussion:

Resolving patch:
diff --git a/gitlab/v4/objects/projects.py b/gitlab/v4/objects/projects.py
--- a/gitlab/v4/objects/projects.py
+++ b/gitlab/v4/objects/projects.py
@@ -57,7 +57,7 @@
 from .integrations import ProjectIntegrationManager, ProjectServiceManager  # noqa: F401
 from .invitations import ProjectInvitationManager  # noqa: F401
 from .issues import ProjectIssueManager  # noqa: F401
-from .iterations import GroupIterationManager  # noqa: F401
+from .iterations import ProjectIterationManager  # noqa: F401
 from .jobs import ProjectJobManager  # noqa: F401
 from .labels import ProjectLabelManager  # noqa: F401
 from .members import ProjectMemberAllManager, ProjectMemberManager  # noqa: F401
@@ -187,7 +187,7 @@ class Project(RefreshMixin, SaveMixin, ObjectDeleteMixin, RepositoryMixin, RESTO
     invitations: ProjectInvitationManager
     issues: ProjectIssueManager
     issues_statistics: ProjectIssuesStatisticsManager
-    iterations: GroupIterationManager
+    iterations: ProjectIterationManager
     jobs: ProjectJobManager
     keys: ProjectKeyManager
     labels: ProjectLabelManager


Test patch:
Repository: open-mmlab/mmaction2

Issue:
ValueError: FastRCNN is not registered in LOCALIZERS, RECOGNIZERS or DETECTORS
Hello
when I train AVA dataset find a error
ValueError: FastRCNN is not registered in LOCALIZERS, RECOGNIZERS or DETECTORS
how to solve it 
think you very much 


Discussion:
try to install mmdetection first `pip install mmdet`
Yes we use mmdet for detectors. @wen-flow Which doc did you follow? We will add some notes.
We need a more conspicuous way to remind users to install `mmdet` when working on spatiotemporal detection tasks.
Where do you think it is more conspicuous for new users? @wen-flow 
Maybe we can add some warnings in `build_detector`, or just raise ImportError here

https://github.com/open-mmlab/mmaction2/blob/e063074944636c4eae0365f50e8e111b7ce086d5/mmaction/models/builder.py#L14
> Maybe we can add some warnings in `build_detector`, or just raise ImportError here
> 
> https://github.com/open-mmlab/mmaction2/blob/e063074944636c4eae0365f50e8e111b7ce086d5/mmaction/models/builder.py#L14

The program doesn't enter `build_detector` unless it finds that the model name has been registered.
https://github.com/open-mmlab/mmaction2/blob/e063074944636c4eae0365f50e8e111b7ce086d5/mmaction/models/builder.py#L67
> The program doesn't enter `build_detector` unless it finds that the model name has been registered.
> https://github.com/open-mmlab/mmaction2/blob/e063074944636c4eae0365f50e8e111b7ce086d5/mmaction/models/builder.py#L67

Thanks for your reply. On one hand, we should improve our install doc. On the other hand, useful error msg should be raised. I think current error msg `ValueError: FastRCNN is not registered in LOCALIZERS, RECOGNIZERS or DETECTORS` is not helpful. Maybe mmdet not installed error or import error should be raised, either in the above `build_model`, or somewhere else. 
> try to install mmdetection first `pip install mmdet`

Thank you for your answer, I have solved this problem 
I think it can be raise a import error to make it  more conspicuous for newcomers

Resolving patch:
diff --git a/mmaction/models/builder.py b/mmaction/models/builder.py
--- a/mmaction/models/builder.py
+++ b/mmaction/models/builder.py
@@ -74,6 +74,10 @@ def build_model(cfg, train_cfg=None, test_cfg=None):
         return build_recognizer(cfg, train_cfg, test_cfg)
     if obj_type in DETECTORS:
         return build_detector(cfg, train_cfg, test_cfg)
+    model_in_mmdet = ['FastRCNN']
+    if obj_type in model_in_mmdet:
+        raise ImportError(
+            'Please install mmdet for spatial temporal detection tasks.')
     raise ValueError(f'{obj_type} is not registered in '
                      'LOCALIZERS, RECOGNIZERS or DETECTORS')
 


Test patch: