FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python-zeroconf/src/zeroconf/_updates.py at master · python-zeroconf/python-zeroconf · GitHub
python-zeroconf
python-zeroconf
Repository navigation
Code
Issues
49
(49)
Pull requests
14
(14)
Discussions
Actions
Projects
Wiki
Security and quality
5
(5)
Insights
Expand file tree
Breadcrumbs
python-zeroconf
/
src
/
zeroconf
/
_updates.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
66 lines (45 loc) · 2.12 KB
Breadcrumbs
python-zeroconf
/
src
/
zeroconf
/
_updates.py
Copy path
File metadata and controls
66 lines (45 loc) · 2.12 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
"""A pure python implementation of multicast DNS service discovery.
Licensed under LGPL-2.1-or-later; see COPYING for details. This file is
part of a continuously modified work; modification dates are recorded
in the project's git history.
"""
from
__future__
import
annotations
from
typing
import
TYPE_CHECKING
from
.
_dns
import
DNSRecord
from
.
_record_update
import
RecordUpdate
if
TYPE_CHECKING
:
from
.
_core
import
Zeroconf
float_
=
float
class
RecordUpdateListener
:
"""Base call for all record listeners.
All listeners passed to async_add_listener should use RecordUpdateListener
as a base class. In the future it will be required.
"""
def
async_update_records
(
self
,
zc
:
Zeroconf
,
now
:
float_
,
records
:
list
[
RecordUpdate
])
->
None
:
"""Update multiple records in one shot.
All records that are received in a single packet are passed
to update_records.
This implementation is a compatibility shim to ensure older code
that uses RecordUpdateListener as a base class will continue to
get calls to update_record. This method will raise
NotImplementedError in a future version.
At this point the cache will not have the new records
Records are passed as a list of RecordUpdate. This
allows consumers of async_update_records to avoid cache lookups.
This method will be run in the event loop.
"""
for
record
in
records
:
self
.
update_record
(
zc
,
now
,
record
.
new
)
def
async_update_records_complete
(
self
)
->
None
:
"""Called when a record update has completed for all handlers.
At this point the cache will have the new records.
This method will be run in the event loop.
"""
def
update_record
(
# pylint: disable=no-self-use
self
,
zc
:
Zeroconf
,
now
:
float
,
record
:
DNSRecord
)
->
None
:
"""Update a single record.
This method is deprecated and will be removed in a future version.
update_records should be implemented instead.
"""
raise
RuntimeError
(
"update_record is deprecated and will be removed in a future version."
)
Back
|
FazBrowse Home
|
New Git URL