Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
TeamSpen210 committed Jun 18, 2024
1 parent bd5a9de commit 7e807a6
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 13 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ extend-ignore = [
"PLC0415", # Imports not at top level are used for specific reasons
"PLW2901", # Allow redefining loop var inside the loop.
"PLW0120", # for-else with return/break inside is just stylistic, exactly equivalent.
"PLC1901", # Allow comparison to empty string etc.

# Flake8-pyi:
"PYI041", # Use int | float
Expand Down
5 changes: 1 addition & 4 deletions src/packages/music.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,7 @@ async def parse(cls, data: ParseData) -> Self:
sample[channel] = None
else:
# Single value, fill it into all channels.
sample = {
channel: sample_block.value
for channel in MusicChannel
}
sample = dict.fromkeys(MusicChannel, sample_block.value)

snd_length_str = data.info['loop_len', '0']
# Allow specifying lengths as [hour:]min:sec.
Expand Down
3 changes: 0 additions & 3 deletions src/perlin.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from collections.abc import Iterable
from typing import Final


__version__: Final[str]

class BaseNoise:
Expand All @@ -16,10 +15,8 @@ class SimplexNoise(BaseNoise):
def noise2(self, x: float, y: float) -> float: ...
def noise3(self, x: float, y: float, z: float) -> float: ...


def lerp(t: float, a: float, b: float) -> float: ...
def grad3(hash: float, x: float, y: float, z: float) -> float: ...


class TileableNoise(BaseNoise):
def noise3(self, x: float, y: float, z: float, repeat: int, base: float = 0.0) -> float: ...
6 changes: 3 additions & 3 deletions src/precomp/antlines.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ def parser(cls, kv: Keyvalues, desc: str) -> Callable[[IndicatorStyle], Indicato
try:
check_switching = PanelSwitchingStyle(check_kv['switching'])
except (LookupError, ValueError):
check_switching = PanelSwitchingStyle.CUSTOM # Assume no optimisations
check_switching = PanelSwitchingStyle.CUSTOM # Assume no optimisations
check_cmd = get_outputs(check_kv, desc, 'check_cmd')
cross_cmd = get_outputs(check_kv, desc, 'cross_cmd')
check = check_inst, check_cmd, cross_cmd
Expand All @@ -231,7 +231,7 @@ def parser(cls, kv: Keyvalues, desc: str) -> Callable[[IndicatorStyle], Indicato
try:
timer_switching = PanelSwitchingStyle(timer_kv['switching'])
except (LookupError, ValueError):
timer_switching = PanelSwitchingStyle.CUSTOM # Assume no optimisations
timer_switching = PanelSwitchingStyle.CUSTOM # Assume no optimisations
timer_blue_cmd = get_outputs(timer_kv, desc, 'blue_cmd')
timer_oran_cmd = get_outputs(timer_kv, desc, 'oran_cmd')
timer_basic_start_cmd = get_outputs(timer_kv, desc, 'basic_start_cmd')
Expand Down Expand Up @@ -639,7 +639,7 @@ def parse_antlines(vmf: VMF) -> tuple[
# Except KeyError: this segment's already done??
for neighbour in neighbours:
if neighbour not in segments:
segments.append(neighbour)
segments.append(neighbour) # noqa: B909 - appending to our own loop var

antlines.setdefault(over_name, []).append(Antline(over_name, segments))

Expand Down
8 changes: 6 additions & 2 deletions src/precomp/barriers.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class Border(Flag):
CORNER_SW = enum_auto()
CORNER_SE = enum_auto()


# IDs for the default barrier definitions. These are detected by the generated brushes, not
# from the instance (since that's the same for both).
GLASS_ID: Final = utils.obj_id('VALVE_GLASS')
Expand Down Expand Up @@ -808,7 +809,7 @@ def parse_conf(kv: Keyvalues) -> None:
thickness=1.0,
keyvalues={
'classname': 'func_brush',
'renderfx': '14', # Constant Glow
'renderfx': '14', # Constant Glow
'solidity': '1', # Never Solid
},
),
Expand Down Expand Up @@ -936,7 +937,10 @@ def parse_map(vmf: VMF, conn_items: Mapping[str, connections.Item]) -> None:
plane_pos, norm, plane,
)
if not found:
LOGGER.warning('glass/grating at {}, {} has no corresponding instance?',plane_pos, norm)
LOGGER.warning(
'glass/grating at {}, {} has no corresponding instance?',
plane_pos, norm,
)
break # The opposite face won't match either.

break # Don't check the remaining faces.
Expand Down
3 changes: 3 additions & 0 deletions src/precomp/brushLoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def grid_to_world[VecT: (Vec, FrozenVec)](pos: VecT) -> VecT:
"""Given a grid position, find the center of the real block."""
return pos * 128 + (64, 64, 64)


w2g = world_to_grid
g2w = grid_to_world

Expand Down Expand Up @@ -109,6 +110,7 @@ def is_bottom(self) -> bool:
"""Is this the base of goo or a bottomless pit?"""
return self.value in (10, 13, 20, 23)


# Keywords to a set of blocks.
BLOCK_LOOKUP = {
block.name.casefold(): {block}
Expand Down Expand Up @@ -149,6 +151,7 @@ class _GridItemsView(ItemsView[FrozenVec, Block]):
"""Implements the Grid.items() view, providing a view over the pos, block pairs."""
# Initialised by superclass.
_mapping: dict[FrozenVec, Block]

def __init__(self, grid: dict[FrozenVec, Block]) -> None:
super().__init__(grid)

Expand Down
2 changes: 1 addition & 1 deletion src/precomp/rand.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def parse_weights(count: int, weights: str) -> list[int]:
# Abandon parsing
break
if len(weight) == 0:
LOGGER.warning('Failed parsing weight: {!r} for {} items',weights, count)
LOGGER.warning('Failed parsing weight: {!r} for {} items', weights, count)
weight = list(range(count))
# random.choice(weight) will now give an index with the correct
# probabilities.
Expand Down

0 comments on commit 7e807a6

Please sign in to comment.