File: Box2D_dir.i

package info (click to toggle)
python-box2d 2.3.2~dfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 3,596 kB
  • ctags: 5,116
  • sloc: python: 14,384; cpp: 13,393; makefile: 8; sh: 6
file content (136 lines) | stat: -rw-r--r-- 4,032 bytes parent folder | download | duplicates (2)
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
/*
* pybox2d -- http://pybox2d.googlecode.com
*
* Copyright (c) 2010 Ken Lauer / sirkne at gmail dot com
* 
* This software is provided 'as-is', without any express or implied
* warranty.  In no event will the authors be held liable for any damages
* arising from the use of this software.
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*/

%pythoncode %{
    def _dir_filter(self):
        """
        Using introspection, mimic dir() by adding up all of the __dicts__
        for the current class and all base classes (type(self).__mro__ returns
        all of the classes that make it up)
        Basically filters by:
            __x__ OK
            __x bad
            _classname bad
        """

        def check(s):
            if s.startswith('__'):
                if s.endswith('__'):
                    return True
                else:
                    return False
            else:
                for typename in typenames:
                    if typename in s:
                        return False
                return True
        
        keys = sum([list(c.__dict__.keys()) for c in type(self).__mro__],[])
        keys += list(self.__dict__.keys())
        typenames = ["_%s" % c.__name__ for c in type(self).__mro__]
        ret = [s for s in list(set(keys)) if check(s)]
        ret.sort()
        return ret

%}


%define DIR_EXTEND(classname)
    %extend classname {
        %pythoncode %{
            __dir__ = _dir_filter
        %}
    }
%enddef

DIR_EXTEND(b2AABB);
DIR_EXTEND(b2AssertException);
DIR_EXTEND(b2Body);
DIR_EXTEND(b2BodyDef);
DIR_EXTEND(b2BroadPhase);
DIR_EXTEND(b2ChainShape);
DIR_EXTEND(b2CircleShape);
DIR_EXTEND(b2ClipVertex);
DIR_EXTEND(b2Color);
DIR_EXTEND(b2Contact);
DIR_EXTEND(b2ContactEdge);
DIR_EXTEND(b2ContactFeature);
DIR_EXTEND(b2ContactFilter);
DIR_EXTEND(b2ContactID);
DIR_EXTEND(b2ContactImpulse);
DIR_EXTEND(b2ContactListener);
DIR_EXTEND(b2ContactManager);
DIR_EXTEND(b2ContactPoint);
DIR_EXTEND(b2DestructionListener);
DIR_EXTEND(b2DistanceInput);
DIR_EXTEND(b2DistanceJoint);
DIR_EXTEND(b2DistanceJointDef);
DIR_EXTEND(b2DistanceOutput);
DIR_EXTEND(b2DistanceProxy);
DIR_EXTEND(b2Draw);
DIR_EXTEND(b2DrawExtended);
DIR_EXTEND(b2EdgeShape);
DIR_EXTEND(b2Filter);
DIR_EXTEND(b2Fixture);
DIR_EXTEND(b2FixtureDef);
DIR_EXTEND(b2FixtureProxy);
DIR_EXTEND(b2FrictionJoint);
DIR_EXTEND(b2FrictionJointDef);
DIR_EXTEND(b2GearJoint);
DIR_EXTEND(b2GearJointDef);
DIR_EXTEND(b2Jacobian);
DIR_EXTEND(b2Joint);
DIR_EXTEND(b2JointDef);
DIR_EXTEND(b2JointEdge);
DIR_EXTEND(b2WheelJoint);
DIR_EXTEND(b2WheelJointDef);
DIR_EXTEND(b2Manifold);
DIR_EXTEND(b2ManifoldPoint);
DIR_EXTEND(b2MassData);
DIR_EXTEND(b2Mat22);
DIR_EXTEND(b2Mat33);
DIR_EXTEND(b2MouseJoint);
DIR_EXTEND(b2MouseJointDef);
DIR_EXTEND(b2Pair);
DIR_EXTEND(b2PolygonShape);
DIR_EXTEND(b2PrismaticJoint);
DIR_EXTEND(b2PrismaticJointDef);
DIR_EXTEND(b2PulleyJoint);
DIR_EXTEND(b2PulleyJointDef);
DIR_EXTEND(b2QueryCallback);
DIR_EXTEND(b2RayCastCallback);
DIR_EXTEND(b2RayCastInput);
DIR_EXTEND(b2RayCastOutput);
DIR_EXTEND(b2RevoluteJoint);
DIR_EXTEND(b2RevoluteJointDef);
DIR_EXTEND(b2RopeJoint);
DIR_EXTEND(b2RopeJointDef);
DIR_EXTEND(b2Shape);
DIR_EXTEND(b2Sweep);
DIR_EXTEND(b2TOIInput);
DIR_EXTEND(b2TOIOutput);
DIR_EXTEND(b2Transform);
DIR_EXTEND(b2Vec2);
DIR_EXTEND(b2Vec3);
DIR_EXTEND(b2Version);
DIR_EXTEND(b2WeldJoint);
DIR_EXTEND(b2WeldJointDef);
DIR_EXTEND(b2World);
DIR_EXTEND(b2WorldManifold);