Source code

Download source archive ↓

src/openpyxl/compat/numbers.py

1# Copyright (c) 2010-2024 openpyxl
2
3from decimal import Decimal
4
5NUMERIC_TYPES = (int, float, Decimal)
6
7
8try:
9    import numpy
10    NUMPY = True
11except ImportError:
12    NUMPY = False
13
14
15if NUMPY:
16    NUMERIC_TYPES = NUMERIC_TYPES + (numpy.short,
17                                     numpy.ushort,
18                                     numpy.intc,
19                                     numpy.uintc,
20                                     numpy.int_,
21                                     numpy.uint,
22                                     numpy.longlong,
23                                     numpy.ulonglong,
24                                     numpy.half,
25                                     numpy.float16,
26                                     numpy.single,
27                                     numpy.double,
28                                     numpy.longdouble,
29                                     numpy.int8,
30                                     numpy.int16,
31                                     numpy.int32,
32                                     numpy.int64,
33                                     numpy.uint8,
34                                     numpy.uint16,
35                                     numpy.uint32,
36                                     numpy.uint64,
37                                     numpy.intp,
38                                     numpy.uintp,
39                                     numpy.float32,
40                                     numpy.float64,
41                                     numpy.bool_,
42                                     numpy.floating,
43                                     numpy.integer)