File: check_imports.py

package info (click to toggle)
pandas 0.23.3%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 167,704 kB
  • sloc: python: 230,826; ansic: 11,317; sh: 682; makefile: 133
file content (35 lines) | stat: -rw-r--r-- 549 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
"""
Check that certain modules are not loaded by `import pandas`
"""
import sys

blacklist = {
    'bs4',
    'html5lib',
    'ipython',
    'jinja2'
    'lxml',
    'numexpr',
    'openpyxl',
    'py',
    'pytest',
    's3fs',
    'scipy',
    'tables',
    'xlrd',
    'xlsxwriter',
    'xlwt',
}


def main():
    import pandas  # noqa

    modules = set(x.split('.')[0] for x in sys.modules)
    imported = modules & blacklist
    if modules & blacklist:
        sys.exit("Imported {}".format(imported))


if __name__ == '__main__':
    main()