Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/astroid/brain/brain_numpy_ma.py: 86%
7 statements
« prev ^ index » next coverage.py v7.2.7, created at 2023-06-07 06:53 +0000
« prev ^ index » next coverage.py v7.2.7, created at 2023-06-07 06:53 +0000
1# Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html
2# For details: https://github.com/pylint-dev/astroid/blob/main/LICENSE
3# Copyright (c) https://github.com/pylint-dev/astroid/blob/main/CONTRIBUTORS.txt
5"""Astroid hooks for numpy ma module."""
7from astroid.brain.helpers import register_module_extender
8from astroid.builder import parse
9from astroid.manager import AstroidManager
12def numpy_ma_transform():
13 """
14 Infer the call of various numpy.ma functions.
16 :param node: node to infer
17 :param context: inference context
18 """
19 return parse(
20 """
21 import numpy.ma
22 def masked_where(condition, a, copy=True):
23 return numpy.ma.masked_array(a, mask=[])
25 def masked_invalid(a, copy=True):
26 return numpy.ma.masked_array(a, mask=[])
27 """
28 )
31register_module_extender(AstroidManager(), "numpy.ma", numpy_ma_transform)