Azure / autorest.python

Extension for AutoRest (https://github.com/Azure/autorest) that generates Python code
MIT License
80 stars 57 forks source link

Got `too-many-locals` error from pylint while the object has too many attributes. #2577

Closed zihyunting closed 2 months ago

zihyunting commented 6 months ago

We have an object that contains 28 attributes and got a too-many-locals error at the init function from pylint.

azure/ai/vision/face/models/_models.py:1118: [R0914(too-many-locals), FaceLandmarks.__init__] Too many local variables (28/25)

There's the definition of the Python object that is generated by TypeSpec:

class FaceLandmarks(_model_base.Model):  # pylint: disable=too-many-instance-attributes
    @overload
    def __init__(
        self,
        *,
        pupil_left: "_models.LandmarkCoordinate",
        pupil_right: "_models.LandmarkCoordinate",
        nose_tip: "_models.LandmarkCoordinate",
        mouth_left: "_models.LandmarkCoordinate",
        mouth_right: "_models.LandmarkCoordinate",
        eyebrow_left_outer: "_models.LandmarkCoordinate",
        eyebrow_left_inner: "_models.LandmarkCoordinate",
        eye_left_outer: "_models.LandmarkCoordinate",
        eye_left_top: "_models.LandmarkCoordinate",
        eye_left_bottom: "_models.LandmarkCoordinate",
        eye_left_inner: "_models.LandmarkCoordinate",
        eyebrow_right_inner: "_models.LandmarkCoordinate",
        eyebrow_right_outer: "_models.LandmarkCoordinate",
        eye_right_inner: "_models.LandmarkCoordinate",
        eye_right_top: "_models.LandmarkCoordinate",
        eye_right_bottom: "_models.LandmarkCoordinate",
        eye_right_outer: "_models.LandmarkCoordinate",
        nose_root_left: "_models.LandmarkCoordinate",
        nose_root_right: "_models.LandmarkCoordinate",
        nose_left_alar_top: "_models.LandmarkCoordinate",
        nose_right_alar_top: "_models.LandmarkCoordinate",
        nose_left_alar_out_tip: "_models.LandmarkCoordinate",
        nose_right_alar_out_tip: "_models.LandmarkCoordinate",
        upper_lip_top: "_models.LandmarkCoordinate",
        upper_lip_bottom: "_models.LandmarkCoordinate",
        under_lip_top: "_models.LandmarkCoordinate",
        under_lip_bottom: "_models.LandmarkCoordinate",
    ): ...
msyyc commented 2 months ago

duplicated issue of https://github.com/Azure/autorest.python/issues/2817