pycharmers.utils.inspect_utils module

Todo

Translate from “module name” to “package name”.

pycharmers.utils.inspect_utils.get_defined_members(obj, predicate=<function <lambda>>)[source]

Get only defined members.

Parameters
  • obj (object) – module.

  • predicate (callable) – Only return members that satisfy a given predicate .

Returns

{"member name" : "member object"}

Return type

dict

Examples

>>> from pycharmers.utils import inspect_utils, get_defined_members
>>> get_defined_members(inspect_utils)
{
    'get_defined_members': <function pycharmers.utils.inspect_utils.get_defined_members(obj, predicate=<function <lambda> at 0x14227fca0>)>,
    'get_imported_members': <function pycharmers.utils.inspect_utils.get_imported_members(obj)>
}
pycharmers.utils.inspect_utils.get_imported_members(obj)[source]

Get import members.

Parameters

obj (str/object) – module or path to files.

Returns

dict : { "module" : ["import members"]}

Examples

>>> from pycharmers.utils import inspect_utils, get_imported_members, dumps_json
>>> print(dumps_json(obj=get_imported_members(inspect_utils)))
{
    "": [
        "re",
        "inspect"
    ],
    "collections": [
        "defaultdict"
    ],
    ".generic_utils": [
        "str_strip",
        "flatten_dual"
    ]
}