| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -54,4 +54,3 @@ def build(setup_kwargs: Any) -> None: | |||
| 54 | 54 | except Exception: | |
| 55 | 55 | if os.environ.get("REQUIRE_CYTHON"): | |
| 56 | 56 | raise | |
| 57 | - pass | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -93,6 +93,24 @@ line-length = 110 | |||
| 93 | 93 | ignore = [ | |
| 94 | 94 | "S101", # use of assert | |
| 95 | 95 | "S104", # S104 Possible binding to all interfaces | |
| 96 | + "PLR0912", # too many to fix right now | ||
| 97 | + "TC001", # too many to fix right now | ||
| 98 | + "TID252", # skip | ||
| 99 | + "PLR0913", # too late to make changes here | ||
| 100 | + "PLR0911", # would be breaking change | ||
| 101 | + "TRY003", # too many to fix | ||
| 102 | + "SLF001", # design choice | ||
| 103 | + "TC003", # too many to fix | ||
| 104 | + "PLR2004" , # too many to fix | ||
| 105 | + "PGH004", # too many to fix | ||
| 106 | + "PGH003", # too many to fix | ||
| 107 | + "SIM110", # this is slower | ||
| 108 | + "FURB136", # this is slower for Cython | ||
| 109 | + "PYI034", # enable when we drop Py3.10 | ||
| 110 | + "PYI032", # breaks Cython | ||
| 111 | + "PYI041", # breaks Cython | ||
| 112 | + "FURB188", # usually slower | ||
| 113 | + "PERF401", # Cython: closures inside cpdef functions not yet supported | ||
| 96 | 114 | ] | |
| 97 | 115 | select = [ | |
| 98 | 116 | "B", # flake8-bugbear | |
@@ -104,8 +122,67 @@ select = [ | |||
| 104 | 122 | "UP", # pyupgrade | |
| 105 | 123 | "I", # isort | |
| 106 | 124 | "RUF", # ruff specific | |
| 125 | + "FLY", # flynt | ||
| 126 | + "FURB", # refurb | ||
| 127 | + "G", # flake8-logging-format , | ||
| 128 | + "PERF", # Perflint | ||
| 129 | + "PGH", # pygrep-hooks | ||
| 130 | + "PIE", # flake8-pie | ||
| 131 | + "PL", # pylint | ||
| 132 | + "PT", # flake8-pytest-style | ||
| 133 | + "PTH", # flake8-pathlib | ||
| 134 | + "PYI", # flake8-pyi | ||
| 135 | + "RET", # flake8-return | ||
| 136 | + "RSE", # flake8-raise , | ||
| 137 | + "SIM", # flake8-simplify | ||
| 138 | + "SLF", # flake8-self | ||
| 139 | + "SLOT", # flake8-slots | ||
| 140 | + "T100", # Trace found: {name} used | ||
| 141 | + "T20", # flake8-print | ||
| 142 | + "TC", # flake8-type-checking | ||
| 143 | + "TID", # Tidy imports | ||
| 144 | + "TRY", # tryceratops | ||
| 107 | 145 | ] | |
| 108 | 146 | ||
| 147 | + [tool.ruff.lint.per-file-ignores] | ||
| 148 | + "tests/**/*" = [ | ||
| 149 | + "D100", | ||
| 150 | + "D101", | ||
| 151 | + "D102", | ||
| 152 | + "D103", | ||
| 153 | + "D104", | ||
| 154 | + "S101", | ||
| 155 | + "SLF001", | ||
| 156 | + "PLR2004", # too many to fix right now | ||
| 157 | + "PT011", # too many to fix right now | ||
| 158 | + "PT006", # too many to fix right now | ||
| 159 | + "PGH003", # too many to fix right now | ||
| 160 | + "PT007", # too many to fix right now | ||
| 161 | + "PT027", # too many to fix right now | ||
| 162 | + "PLW0603" , # too many to fix right now | ||
| 163 | + "PLR0915", # too many to fix right now | ||
| 164 | + "FLY002", # too many to fix right now | ||
| 165 | + "PT018", # too many to fix right now | ||
| 166 | + "PLR0124", # too many to fix right now | ||
| 167 | + "SIM202" , # too many to fix right now | ||
| 168 | + "PT012" , # too many to fix right now | ||
| 169 | + "TID252", # too many to fix right now | ||
| 170 | + "PLR0913", # skip this one | ||
| 171 | + "SIM102" , # too many to fix right now | ||
| 172 | + "SIM108", # too many to fix right now | ||
| 173 | + "TC003", # too many to fix right now | ||
| 174 | + "TC002", # too many to fix right now | ||
| 175 | + "T201", # too many to fix right now | ||
| 176 | + ] | ||
| 177 | + "bench/**/*" = [ | ||
| 178 | + "T201", # intended | ||
| 179 | + ] | ||
| 180 | + "examples/**/*" = [ | ||
| 181 | + "T201", # intended | ||
| 182 | + ] | ||
| 183 | + "setup.py" = ["D100"] | ||
| 184 | + "conftest.py" = ["D100"] | ||
| 185 | + "docs/conf.py" = ["D100"] | ||
| 109 | 186 | ||
| 110 | 187 | [tool.pylint.BASIC] | |
| 111 | 188 | class-const-naming-style = "any" | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -60,9 +60,7 @@ def suppresses(self, question: DNSQuestion, now: _float, known_answers: set[DNSR | |||
| 60 | 60 | return False | |
| 61 | 61 | # The last question has more known answers than | |
| 62 | 62 | # we knew so we have to ask | |
| 63 | - if previous_known_answers - known_answers: | ||
| 64 | - return False | ||
| 65 | - return True | ||
| 63 | + return not previous_known_answers - known_answers | ||
| 66 | 64 | ||
| 67 | 65 | def async_expire(self, now: _float) -> None: | |
| 68 | 66 | """Expire the history of old questions.""" | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -398,7 +398,7 @@ def _read_bitmap(self, end: _int) -> list[int]: | |||
| 398 | 398 | bitmap_length = view[offset_plus_one] | |
| 399 | 399 | bitmap_end = offset_plus_two + bitmap_length | |
| 400 | 400 | for i, byte in enumerate(self.data[offset_plus_two:bitmap_end]): | |
| 401 | - for bit in range(0, 8): | ||
| 401 | + for bit in range(8): | ||
| 402 | 402 | if byte & (0x80 >> bit): | |
| 403 | 403 | rdtypes.append(bit + window * 256 + i * 8) | |
| 404 | 404 | self.offset += 2 + bitmap_length | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -272,7 +272,7 @@ def write_name(self, name: str_) -> None: | |||
| 272 | 272 | """ | |
| 273 | 273 | ||
| 274 | 274 | # split name into each label | |
| 275 | - if name.endswith("."): | ||
| 275 | + if name and name[-1] == ".": | ||
| 276 | 276 | name = name[:-1] | |
| 277 | 277 | ||
| 278 | 278 | index = self.names.get(name, 0) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -43,6 +43,6 @@ def __getitem__(self, index: int) -> DNSRecord | None: | |||
| 43 | 43 | """Get the new or old record.""" | |
| 44 | 44 | if index == 0: | |
| 45 | 45 | return self.new | |
| 46 | - elif index == 1: | ||
| 46 | + if index == 1: | ||
| 47 | 47 | return self.old | |
| 48 | 48 | raise IndexError(index) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -38,13 +38,13 @@ class ServiceStateChange(enum.Enum): | |||
| 38 | 38 | ||
| 39 | 39 | class ServiceListener: | |
| 40 | 40 | def add_service(self, zc: Zeroconf, type_: str, name: str) -> None: | |
| 41 | - raise NotImplementedError() | ||
| 41 | + raise NotImplementedError | ||
| 42 | 42 | ||
| 43 | 43 | def remove_service(self, zc: Zeroconf, type_: str, name: str) -> None: | |
| 44 | - raise NotImplementedError() | ||
| 44 | + raise NotImplementedError | ||
| 45 | 45 | ||
| 46 | 46 | def update_service(self, zc: Zeroconf, type_: str, name: str) -> None: | |
| 47 | - raise NotImplementedError() | ||
| 47 | + raise NotImplementedError | ||
| 48 | 48 | ||
| 49 | 49 | ||
| 50 | 50 | class Signal: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -378,13 +378,13 @@ def _set_properties(self, properties: dict[str | bytes, str | bytes | None]) -> | |||
| 378 | 378 | result = b"" | |
| 379 | 379 | for key, value in properties.items(): | |
| 380 | 380 | if isinstance(key, str): | |
| 381 | - key = key.encode("utf-8") | ||
| 381 | + key = key.encode("utf-8") # noqa: PLW2901 | ||
| 382 | 382 | properties_contain_str = True | |
| 383 | 383 | ||
| 384 | 384 | record = key | |
| 385 | 385 | if value is not None: | |
| 386 | 386 | if not isinstance(value, bytes): | |
| 387 | - value = str(value).encode("utf-8") | ||
| 387 | + value = str(value).encode("utf-8") # noqa: PLW2901 | ||
| 388 | 388 | properties_contain_str = True | |
| 389 | 389 | record += b"=" + value | |
| 390 | 390 | list_.append(record) | |
@@ -524,7 +524,7 @@ def _process_record_threadsafe(self, zc: Zeroconf, record: DNSRecord, now: float | |||
| 524 | 524 | # since by default IPv4Address.__eq__ compares the | |
| 525 | 525 | # the addresses on version and int which more than | |
| 526 | 526 | # we need here since we know the version is 4. | |
| 527 | - elif ip_addr.zc_integer != ipv4_addresses[0].zc_integer: | ||
| 527 | + if ip_addr.zc_integer != ipv4_addresses[0].zc_integer: | ||
| 528 | 528 | ipv4_addresses.remove(ip_addr) | |
| 529 | 529 | ipv4_addresses.insert(0, ip_addr) | |
| 530 | 530 | ||
@@ -540,7 +540,7 @@ def _process_record_threadsafe(self, zc: Zeroconf, record: DNSRecord, now: float | |||
| 540 | 540 | # since by default IPv6Address.__eq__ compares the | |
| 541 | 541 | # the addresses on version and int which more than | |
| 542 | 542 | # we need here since we know the version is 6. | |
| 543 | - elif ip_addr.zc_integer != self._ipv6_addresses[0].zc_integer: | ||
| 543 | + if ip_addr.zc_integer != self._ipv6_addresses[0].zc_integer: | ||
| 544 | 544 | ipv6_addresses.remove(ip_addr) | |
| 545 | 545 | ipv6_addresses.insert(0, ip_addr) | |
| 546 | 546 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -67,10 +67,9 @@ def test_ttl(self): | |||
| 67 | 67 | def get_ttl(record_type): | |
| 68 | 68 | if expected_ttl is not None: | |
| 69 | 69 | return expected_ttl | |
| 70 | - elif record_type in [const._TYPE_A, const._TYPE_SRV, const._TYPE_NSEC]: | ||
| 70 | + if record_type in [const._TYPE_A, const._TYPE_SRV, const._TYPE_NSEC]: | ||
| 71 | 71 | return const._DNS_HOST_TTL | |
| 72 | - else: | ||
| 73 | - return const._DNS_OTHER_TTL | ||
| 72 | + return const._DNS_OTHER_TTL | ||
| 74 | 73 | ||
| 75 | 74 | def _process_outgoing_packet(out): | |
| 76 | 75 | """Sends an outgoing packet.""" | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,7 +3,7 @@ | |||
| 3 | 3 | from __future__ import annotations | |
| 4 | 4 | ||
| 5 | 5 | import zeroconf as r | |
| 6 | - import zeroconf.const as const | ||
| 6 | + from zeroconf import const | ||
| 7 | 7 | from zeroconf._history import QuestionHistory | |
| 8 | 8 | ||
| 9 | 9 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments