Thanks to visit codestin.com
Credit goes to github.com

Skip to content

error: Value of type "Union[GitlabList, List[Dict[str, Any]]]" is not indexable [index] #2338

Open
@stdedos

Description

@stdedos

Description of the problem, including code/CLI snippet

	....

    ci_commit_sha = os.environ["CI_COMMIT_SHA"]
    mrs_related = project.commits.get(ci_commit_sha).merge_requests()

    if not mrs_related:
        raise ValueError(f"ci_commit_sha '{ci_commit_sha}' has no associated MRs!")

    if len(mrs_related) > 1:
        msg = f"ci_commit_sha '{ci_commit_sha}' has >1 associated MRs: [{csv(mrs_related)}]"
        warnings.warn(msg)

    return mrs_related[0]["iid"]

Expected Behavior

No mypy errors

Actual Behavior

mypy errors

Specifications

  • python-gitlab version: 3.10.0
  • API version you are using (v3/v4): v4
  • Gitlab server version (or gitlab.com): gitlab.com

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions