Skip to content

Commit

Permalink
Reformat with new black update
Browse files Browse the repository at this point in the history
And bump mypy and fix some related CI
  • Loading branch information
m-col committed Jan 31, 2022
1 parent cd0dc89 commit 2a23e9a
Show file tree
Hide file tree
Showing 16 changed files with 25 additions and 20 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ jobs:
LIBDRM: 2.4.109
strategy:
matrix:
# if you change one of these, be sure to update
# /tox.ini:[gh-actions] as well
# If you change one of these, be sure to update:
# - /tox.ini:[gh-actions]
# - /setup.cfg:[mypy]
# - /libqtile/scripts/check.py mypy argument
python-version: [pypy-3.7, 3.7, 3.8, 3.9, '3.10']
steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion libqtile/backend/x11/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ def get_property(self, prop, type=None, unpack=None):
self.conn.atoms[prop] if isinstance(prop, str) else prop,
self.conn.atoms[type] if isinstance(type, str) else type,
0,
(2 ** 32) - 1,
(2**32) - 1,
).reply()
except (xcffib.xproto.WindowError, xcffib.xproto.AccessError):
logger.debug("X error in GetProperty (wid=%r, prop=%r), ignoring", self.wid, prop)
Expand Down
2 changes: 1 addition & 1 deletion libqtile/command/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
if TYPE_CHECKING:
from typing import Any, List, Tuple

from libqtile.command.interface import SelectorType
from libqtile.command.graph import GraphType
from libqtile.command.interface import SelectorType


class CommandClient:
Expand Down
4 changes: 2 additions & 2 deletions libqtile/command/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
from __future__ import annotations

import abc
from typing import TYPE_CHECKING
from typing import TYPE_CHECKING, Union

if TYPE_CHECKING:
from typing import Dict, List, Optional, Tuple, Type, Union
from typing import Dict, List, Optional, Tuple, Type

SelectorType = Tuple[str, Optional[str | int]]

Expand Down
2 changes: 1 addition & 1 deletion libqtile/layout/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from libqtile import hook
from libqtile.layout.base import Layout

to_superscript = dict(zip(map(ord, u"0123456789"), map(ord, u"⁰¹²³⁴⁵⁶⁷⁸⁹")))
to_superscript = dict(zip(map(ord, "0123456789"), map(ord, "⁰¹²³⁴⁵⁶⁷⁸⁹")))


class TreeNode:
Expand Down
2 changes: 1 addition & 1 deletion libqtile/lazy.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
if TYPE_CHECKING:
from typing import Dict, Iterable, List, Set, Tuple

from libqtile.config import Match
from libqtile.command.graph import SelectorType
from libqtile.config import Match


class LazyCall:
Expand Down
2 changes: 1 addition & 1 deletion libqtile/scripts/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def type_check_config_args(config_file):
try:
# we want to use Literal, which is in 3.8. If people have a mypy that
# is too old, they can upgrade; this is an optional check anyways.
subprocess.check_call(["mypy", "--python-version=3.8", config_file])
subprocess.check_call(["mypy", "--python-version=3.10", config_file])
print("config file type checking succeeded")
except subprocess.CalledProcessError as e:
print("config file type checking failed: {}".format(e))
Expand Down
2 changes: 1 addition & 1 deletion libqtile/scripts/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

try:
# Python>3.7 can get the version from importlib
from importlib.metadata import distribution # type: ignore
from importlib.metadata import distribution

VERSION = distribution("qtile").version
except ModuleNotFoundError:
Expand Down
2 changes: 2 additions & 0 deletions libqtile/widget/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@
# | ORIENTATION_BOTH | Widget displayed | Widget displayed |
# | | horizontally | vertically |
# +------------------------+--------------------+--------------------+


class _Orientations(int):
def __new__(cls, value, doc):
return super().__new__(cls, value)
Expand Down
2 changes: 1 addition & 1 deletion libqtile/widget/net.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def convert_b(self, num_bytes: float) -> Tuple[float, str]:
else:
power = self.allowed_prefixes.index(self.prefix)

converted_bytes = num_bytes / self.factor ** power
converted_bytes = num_bytes / self.factor**power
unit = self.units[power]

return converted_bytes, unit
Expand Down
1 change: 1 addition & 0 deletions libqtile/widget/statusnotifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import asyncio
import os
from functools import partial

# dbus_next is incompatible with deferred type evaluation
from typing import Callable, List, Optional

Expand Down
1 change: 0 additions & 1 deletion libqtile/widget/systray.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
from libqtile.confreader import ConfigError
from libqtile.widget import base


XEMBED_PROTOCOL_VERSION = 0


Expand Down
8 changes: 4 additions & 4 deletions libqtile/widget/volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,13 @@ def _update_drawer(self):
self.drawer.ctx.paint()
elif self.emoji:
if self.volume <= 0:
self.text = u"\U0001f507"
self.text = "\U0001f507"
elif self.volume <= 30:
self.text = u"\U0001f508"
self.text = "\U0001f508"
elif self.volume < 80:
self.text = u"\U0001f509"
self.text = "\U0001f509"
elif self.volume >= 80:
self.text = u"\U0001f50a"
self.text = "\U0001f50a"
else:
if self.volume == -1:
self.text = "M"
Expand Down
3 changes: 2 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,11 @@ balanced_wrapping = true
default_section = THIRDPARTY
known_first_party = libqtile,test
include_trailing_comma = true
profile = black

[mypy]
mypy_path = stubs
python_version = 3.7
python_version = 3.10
warn_unused_configs = True
warn_unused_ignores = True
warn_unreachable = True
Expand Down
2 changes: 1 addition & 1 deletion test/backend/x11/test_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@ def test_net_frame_extents(xmanager):

def assert_frame(wid, frame):
r = conn.conn.core.GetProperty(
False, wid, conn.atoms["_NET_FRAME_EXTENTS"], conn.atoms["CARDINAL"], 0, (2 ** 32) - 1
False, wid, conn.atoms["_NET_FRAME_EXTENTS"], conn.atoms["CARDINAL"], 0, (2**32) - 1
).reply()
assert r.value.to_atoms() == frame

Expand Down
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ commands =
[testenv:pep8]
deps =
flake8
flake8-black
flake8-black>=0.2.4
flake8-isort
flake8-tidy-imports
pep8-naming
Expand All @@ -81,7 +81,7 @@ commands =

[testenv:mypy]
deps =
mypy == 0.930
mypy == 0.931
bowler
dbus-next
xcffib >= 0.10.1
Expand Down

0 comments on commit 2a23e9a

Please sign in to comment.