Explorar o código

add pycodestyle

Falko Schindler hai 1 ano
pai
achega
98e00b954b

+ 4 - 0
pyproject.toml

@@ -84,7 +84,11 @@ line-length = 120
 # See complete list: https://beta.ruff.rs/docs/rules
 select = [
     "I",  # isort
+    "E",  # pycodestyle
 ]
 fixable = [
     "I",  # isort
 ]
+ignore = [
+    "E501", # line too long
+]

+ 2 - 2
tests/test_auto_context.py

@@ -75,10 +75,10 @@ def test_autoupdate_after_connected(screen: Screen):
 def test_autoupdate_on_async_event_handler(screen: Screen):
     async def open_dialog():
         with ui.dialog() as dialog, ui.card():
-            l = ui.label('This should be visible')
+            label = ui.label('This should be visible')
         dialog.open()
         await asyncio.sleep(1)
-        l.text = 'New text after 1 second'
+        label.text = 'New text after 1 second'
     ui.button('Dialog', on_click=open_dialog)
 
     screen.open('/')

+ 2 - 2
tests/test_link.py

@@ -52,8 +52,8 @@ def test_replace_link(screen: Screen):
 
 
 def test_updating_href_prop(screen: Screen):
-    l = ui.link('nicegui.io', 'https://nicegui.io')
-    ui.button('change href', on_click=lambda: l.props('href="https://github.com/zauberzeug/nicegui"'))
+    label = ui.link('nicegui.io', 'https://nicegui.io')
+    ui.button('change href', on_click=lambda: label.props('href="https://github.com/zauberzeug/nicegui"'))
 
     screen.open('/')
     assert screen.find('nicegui.io').get_attribute('href') == 'https://nicegui.io/'

+ 6 - 6
website/documentation/content/dark_mode_documentation.py

@@ -11,15 +11,15 @@ def main_demo() -> None:
     # ui.button('Dark', on_click=dark.enable)
     # ui.button('Light', on_click=dark.disable)
     # END OF DEMO
-    l = ui.label('Switch mode:')
-    c = l.parent_slot.parent
+    label = ui.label('Switch mode:')
+    container = label.parent_slot.parent
     ui.button('Dark', on_click=lambda: (
-        l.style('color: white'),
-        c.style(f'background-color: {WINDOW_BG_COLORS["browser"][1]}'),
+        label.style('color: white'),
+        container.style(f'background-color: {WINDOW_BG_COLORS["browser"][1]}'),
     ))
     ui.button('Light', on_click=lambda: (
-        l.style('color: black'),
-        c.style(f'background-color: {WINDOW_BG_COLORS["browser"][0]}'),
+        label.style('color: black'),
+        container.style(f'background-color: {WINDOW_BG_COLORS["browser"][0]}'),
     ))