File tree Expand file tree Collapse file tree 3 files changed +61
-0
lines changed
Expand file tree Collapse file tree 3 files changed +61
-0
lines changed Original file line number Diff line number Diff line change 1+ import netaddr
2+
3+ ip = netaddr .IPAddress ('10.0.2.15' )
4+ print ip .version
5+ print repr (ip )
6+ print ip
7+
8+ print str (ip )
9+ print ip .format ()
10+ print int (ip )
11+ print hex (ip )
12+
13+ ip = netaddr .IPNetwork ('10.0.2.15/20' )
14+ print ip .network , ip .broadcast
15+ print ip .netmask , ip .hostmask
16+ print ip .size
17+ print ip .ip .bits ()
18+ print ip .network .bits ()
19+ print ip .netmask .bits ()
20+ print ip .broadcast .bits ()
21+ list_ip = list (ip )
22+ print len (list_ip )
Original file line number Diff line number Diff line change 1+ import six
2+ import abc
3+
4+ @six .add_metaclass (abc .ABCMeta )
5+ class test (object ):
6+ @abc .abstractmethod
7+ def func (self ):
8+ pass
9+
10+ class sub_test (test ):
11+ def __init__ (self ):
12+ print 'aaaa'
13+ def func (self ):
14+ print 'success'
15+
16+ mm = sub_test ()
Original file line number Diff line number Diff line change 1+ import sys
2+ import six
3+ import abc
4+
5+ PY2 = sys .version_info [0 ] == 2
6+ PY3 = sys .version_info [0 ] == 3
7+ PY34 = sys .version_info [0 :2 ] >= (3 , 4 )
8+
9+ if sys .platform .startswith ('linux' ):
10+ print 'linux'
11+
12+ if six .PY2 :
13+ print 'The version of the python is 2'
14+
15+ @six .add_metaclass (abc .ABCMeta )
16+ class test (object ):
17+ def __init__ (self ):
18+ print 'test metaclass'
19+
20+ sub_test = test ()
21+ print type (test )
22+ print type (sub_test )
23+ # print issubclass(sub_test, test)
You can’t perform that action at this time.
0 commit comments