This commit is contained in:
Kovid Goyal 2020-09-09 15:50:46 +05:30
parent 13552bef07
commit 8fd6d2ee5d
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
3 changed files with 24 additions and 24 deletions

View File

@ -2040,11 +2040,13 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin):
# Function to monkeypatch zeroconf to remove the 15 character name length restriction.
# Copied from https://github.com/jstasiak/python-zeroconf version 0.28.1
from zeroconf import (BadTypeInNameException, _HAS_A_TO_Z,
_HAS_ONLY_A_TO_Z_NUM_HYPHEN_UNDERSCORE,
_HAS_ASCII_CONTROL_CHARS,
_HAS_ONLY_A_TO_Z_NUM_HYPHEN)
def service_type_name(type_: str, *, allow_underscores: bool = False) -> str:
"""
Validate a fully qualified service name, instance or subtype. [rfc6763]
@ -2143,4 +2145,3 @@ def service_type_name(type_: str, *, allow_underscores: bool = False) -> str:
)
return '_' + name + type_[-len('._tcp.local.') :]

View File

@ -477,10 +477,9 @@ class Quickview(QDialog, Ui_Quickview):
try:
self.current_column = (
self.view.column_map.index('authors')
if self.current_column is None
and self.view.column_map[idx.column()] == 'title'
else idx.column())
self.view.column_map.index('authors') if (
self.current_column is None and self.view.column_map[idx.column()] == 'title'
) else idx.column())
key = self.view.column_map[self.current_column]
book_id = self.view.model().id(idx.row())
if self.current_book_id == book_id and self.current_key == key:

View File

@ -357,16 +357,16 @@ class TemplateFormatter(string.Formatter):
lex_scanner = re.Scanner([
(r'(==#|!=#|<=#|<#|>=#|>#|==|!=|<=|<|>=|>)',
lambda x,t: (_Parser.LEX_INFIX, t)),
(r'if\b', lambda x,t: (_Parser.LEX_IF, t)),
(r'then\b', lambda x,t: (_Parser.LEX_THEN, t)),
(r'else\b', lambda x,t: (_Parser.LEX_ELSE, t)),
(r'fi\b', lambda x,t: (_Parser.LEX_FI, t)),
(r'[(),=;]', lambda x,t: (_Parser.LEX_OP, t)),
(r'-?[\d\.]+', lambda x,t: (_Parser.LEX_CONST, t)),
(r'\$', lambda x,t: (_Parser.LEX_ID, t)),
(r'\w+', lambda x,t: (_Parser.LEX_ID, t)),
(r'".*?((?<!\\)")', lambda x,t: (_Parser.LEX_CONST, t[1:-1])),
(r'\'.*?((?<!\\)\')', lambda x,t: (_Parser.LEX_CONST, t[1:-1])),
(r'if\b', lambda x,t: (_Parser.LEX_IF, t)), # noqa
(r'then\b', lambda x,t: (_Parser.LEX_THEN, t)), # noqa
(r'else\b', lambda x,t: (_Parser.LEX_ELSE, t)), # noqa
(r'fi\b', lambda x,t: (_Parser.LEX_FI, t)), # noqa
(r'[(),=;]', lambda x,t: (_Parser.LEX_OP, t)), # noqa
(r'-?[\d\.]+', lambda x,t: (_Parser.LEX_CONST, t)), # noqa
(r'\$', lambda x,t: (_Parser.LEX_ID, t)), # noqa
(r'\w+', lambda x,t: (_Parser.LEX_ID, t)), # noqa
(r'".*?((?<!\\)")', lambda x,t: (_Parser.LEX_CONST, t[1:-1])), # noqa
(r'\'.*?((?<!\\)\')', lambda x,t: (_Parser.LEX_CONST, t[1:-1])), # noqa
(r'\n#.*?(?:(?=\n)|$)', None),
(r'\s', None),
], flags=re.DOTALL)