issharedobject()   A
last analyzed

Complexity

Conditions 4

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 4
c 1
b 0
f 0
dl 0
loc 12
rs 9.2
1
#!/usr/bin/env python
2
import os
3
import inspect
4
from public import public
5
6
7
@public
8
def issharedobject(obj):
9
    """return True if module is shared object (*.so)"""
10
    if not obj:
11
        return False
12
    module = inspect.getmodule(obj)
13
    if not module:
14
        return
15
    path = getattr(module, "__file__", None)
16
    if path:
17
        return os.path.splitext(path)[1] == ".so"
18
    return False
19