Skip to content

Commit

Permalink
Ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
davegaeddert committed Jul 5, 2024
1 parent 2ede4c9 commit a04ba4f
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 10 deletions.
2 changes: 1 addition & 1 deletion plain-dev/plain/dev/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from .db import cli as db_cli
from .pid import Pid
from .services import Services
from .utils import plainpackage_installed, has_pyproject_toml
from .utils import has_pyproject_toml, plainpackage_installed

try:
import tomllib
Expand Down
4 changes: 3 additions & 1 deletion plain-dev/plain/dev/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ class Config(PackageConfig):

def ready(self):
# Symlink the plain package into .plain so we can look at it easily
plain_path = Path(importlib.util.find_spec("plain.runtime").origin).parent.parent
plain_path = Path(
importlib.util.find_spec("plain.runtime").origin
).parent.parent
if not settings.BOLT_TEMP_PATH.exists():
settings.BOLT_TEMP_PATH.mkdir()
src_path = settings.BOLT_TEMP_PATH / "src"
Expand Down
5 changes: 4 additions & 1 deletion plain-dev/plain/dev/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ def get_services(root):
pyproject = tomllib.load(f)

return (
pyproject.get("tool", {}).get("plain", {}).get("dev", {}).get("services", {})
pyproject.get("tool", {})
.get("plain", {})
.get("dev", {})
.get("services", {})
)

def __init__(self):
Expand Down
6 changes: 3 additions & 3 deletions plain-tailwind/plain/tailwind/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ def set_version_in_config(self, version):
with open(pyproject_path) as f:
config = tomlkit.load(f)

config.setdefault("tool", {}).setdefault("plain", {}).setdefault("tailwind", {})[
"version"
] = version
config.setdefault("tool", {}).setdefault("plain", {}).setdefault(
"tailwind", {}
)["version"] = version

with open(pyproject_path, "w") as f:
tomlkit.dump(config, f)
Expand Down
5 changes: 4 additions & 1 deletion plain/plain/internal/files/uploadhandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
import os
from io import BytesIO

from plain.internal.files.uploadedfile import InMemoryUploadedFile, TemporaryUploadedFile
from plain.internal.files.uploadedfile import (
InMemoryUploadedFile,
TemporaryUploadedFile,
)
from plain.runtime import settings
from plain.utils.module_loading import import_string

Expand Down
4 changes: 3 additions & 1 deletion plain/plain/internal/handlers/exception.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ def response_for_exception(request, exc):

# The request logger receives events for any problematic request
# The security logger receives events for all SuspiciousOperations
security_logger = logging.getLogger("plain.security.%s" % exc.__class__.__name__)
security_logger = logging.getLogger(
"plain.security.%s" % exc.__class__.__name__
)
security_logger.error(
str(exc),
exc_info=exc,
Expand Down
4 changes: 3 additions & 1 deletion plain/plain/preflight/security/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,9 @@ def _security_middleware():


def _xframe_middleware():
return "plain.middleware.clickjacking.XFrameOptionsMiddleware" in settings.MIDDLEWARE
return (
"plain.middleware.clickjacking.XFrameOptionsMiddleware" in settings.MIDDLEWARE
)


@register(deploy=True)
Expand Down
4 changes: 3 additions & 1 deletion plain/tests/test_runtime.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from plain.runtime import settings
from plain.runtime import setup as plain_setup # Rename so pytest doesn't call setup()...
from plain.runtime import (
setup as plain_setup, # Rename so pytest doesn't call setup()...
)


def test_setup():
Expand Down

0 comments on commit a04ba4f

Please sign in to comment.