laike9m / pdir2

Pretty dir() printing with joy:beer:
MIT License
1.32k stars 47 forks source link

Add more categories(#13) #46

Closed liwt31 closed 5 years ago

liwt31 commented 5 years ago

For example, class defination:

class A(object):
    class_variable = 1

    @staticmethod
    def static_method():
        pass

    @classmethod
    def class_method(cls):
        pass

    def __init__(self):
        self.instance_variable = 2

    def method(self):
        pass

Sample output:

class variable:
    class_variable
instance variable:
    instance_variable
special attribute:
    __class__, __dict__, __doc__, __module__, __weakref__
abstract class:
    __subclasshook__
object customization:
    __format__, __hash__, __init__, __new__, __repr__, __sizeof__, __str__
rich comparison:
    __eq__, __ge__, __gt__, __le__, __lt__, __ne__
attribute access:
    __delattr__, __dir__, __getattribute__, __setattr__
class customization:
    __init_subclass__
pickle:
    __reduce__, __reduce_ex__
static method:
    static_method: staticmethod(function) -> method
class method:
    class_method: classmethod(function) -> method
function:
    method:
laike9m commented 5 years ago

Please reformat your code using black, be sure to use the config here. This applies to future commit as well. Thanks.

liwt31 commented 5 years ago

Please reformat your code using black, be sure to use the config here. This applies to future commit as well. Thanks.

Sorry I didn't notice the requirement! This should be fixed right away.