Skip to content

ty: Attribute v4 is not defined on <module 'gitlab'> in union <module 'gitlab'> | <module 'gitlab'> #3384

@amai2012

Description

@amai2012

Description of the problem, including code/CLI snippet

ty 0.0.26 reports a failure on my code snippet

#!/usr/bin/env python3

from __future__ import annotations

import gitlab.v4.objects
from gitlab.v4.objects import gitlab


def get_runners_shortlist() -> list[gitlab.v4.objects.Runner]:
  gl = gitlab.Gitlab(url="httos://gitlab.my.company", private_token="topsecred")
  return gl.runners.list(get_all=True)

I tried using the hints given on #2213

Expected Behavior

no error report

Actual Behavior

 ty check .\app\myrunners.py      
error[unresolved-attribute]: Attribute `v4` is not defined on `<module 'gitlab'>` in union `<module 'gitlab'> | <module 'gitlab'>`
  --> app\myrunners.py:9:37
   |
 9 | def get_runners_shortlist() -> list[gitlab.v4.objects.Runner]:
   |                                     ^^^^^^^^^
10 |   gl = gitlab.Gitlab(url="httos://gitlab.my.company", private_token="topsecret")
11 |   return gl.runners.list(get_all=True)
   |
info: rule `unresolved-attribute` is enabled by default

Found 1 diagnostic

Specifications

  • python-gitlab version: any tried, currently 8.2.0
  • Gitlab server version (or gitlab.com): <doesn't matter>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions