feat: optimize dns objects by adding pxd files (#1113) · python-zeroconf/python-zeroconf@919d4d8

2 files changed

lines changed

Original file line numberDiff line numberDiff line change

@@ -0,0 +1,76 @@

1+
2+
3+
4+

cdef object _LEN_BYTE

5+

cdef object _LEN_SHORT

6+

cdef object _LEN_INT

7+
8+

cdef object _NAME_COMPRESSION_MIN_SIZE

9+

cdef object _BASE_MAX_SIZE

10+
11+

cdef object _EXPIRE_FULL_TIME_MS

12+

cdef object _EXPIRE_STALE_TIME_MS

13+

cdef object _RECENT_TIME_MS

14+
15+
16+

cdef class DNSEntry:

17+
18+

cdef public key

19+

cdef public name

20+

cdef public type

21+

cdef public class_

22+

cdef public unique

23+
24+

cdef class DNSQuestion(DNSEntry):

25+
26+

cdef public _hash

27+
28+

cdef class DNSRecord(DNSEntry):

29+
30+

cdef public ttl

31+

cdef public created

32+
33+

cdef class DNSAddress(DNSRecord):

34+
35+

cdef public _hash

36+

cdef public address

37+

cdef public scope_id

38+
39+
40+

cdef class DNSHinfo(DNSRecord):

41+
42+

cdef public _hash

43+

cdef public cpu

44+

cdef public os

45+
46+
47+

cdef class DNSPointer(DNSRecord):

48+
49+

cdef public _hash

50+

cdef public alias

51+
52+

cdef class DNSText(DNSRecord):

53+
54+

cdef public _hash

55+

cdef public text

56+
57+

cdef class DNSService(DNSRecord):

58+
59+

cdef public _hash

60+

cdef public priority

61+

cdef public weight

62+

cdef public port

63+

cdef public server

64+

cdef public server_key

65+
66+

cdef class DNSNsec(DNSRecord):

67+
68+

cdef public _hash

69+

cdef public next_name

70+

cdef public rdtypes

71+
72+
73+

cdef class DNSRRSet:

74+
75+

cdef _records

76+

cdef _lookup

Original file line numberDiff line numberDiff line change

@@ -427,6 +427,9 @@ def _mock_get_expiration_time(self, percent):

427427

service_removed_event.wait(wait_time)

428428

assert service_added_count == 3

429429

assert service_removed_count == 3

430+

except TypeError:

431+

# Cannot be patched with cython as get_expiration_time is immutable

432+

pass

430433
431434

finally:

432435

assert len(zeroconf.listeners) == 1