Updated python packages
This commit is contained in:
@@ -157,8 +157,8 @@ class Spool(BaseModel):
|
||||
"""Create a new Pydantic spool object from a database spool object."""
|
||||
filament = Filament.from_db(item.filament)
|
||||
|
||||
remaining_weight: Optional[float] = None # noqa: FA100
|
||||
remaining_length: Optional[float] = None # noqa: FA100
|
||||
remaining_weight: Optional[float] = None
|
||||
remaining_length: Optional[float] = None
|
||||
if filament.weight is not None:
|
||||
remaining_weight = max(filament.weight - item.used_weight, 0)
|
||||
remaining_length = length_from_weight(
|
||||
|
||||
@@ -16,15 +16,15 @@ def bump() -> None:
|
||||
print("Please specify a bump type, e.g. major, minor, micro.")
|
||||
sys.exit(1)
|
||||
|
||||
if subprocess.run(["git", "diff", "--quiet", "pyproject.toml"], cwd=project_root).returncode != 0:
|
||||
if subprocess.run(["git", "diff", "--quiet", "pyproject.toml"], cwd=project_root, check=False).returncode != 0:
|
||||
print("The pyproject.toml file is dirty, please commit your changes before bumping the version number.")
|
||||
sys.exit(1)
|
||||
|
||||
if subprocess.run(["git", "diff", "--cached", "--quiet"], cwd=project_root).returncode != 0:
|
||||
if subprocess.run(["git", "diff", "--cached", "--quiet"], cwd=project_root, check=False).returncode != 0:
|
||||
print("There are staged changes, please commit them before bumping the version number.")
|
||||
sys.exit(1)
|
||||
|
||||
if subprocess.run(["pip", "show", "pdm-bump"], cwd=project_root, capture_output=True).returncode != 0:
|
||||
if subprocess.run(["pip", "show", "pdm-bump"], cwd=project_root, capture_output=True, check=False).returncode != 0:
|
||||
print("Please install pdm-bump using pip.")
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ async def create(
|
||||
color_hex: Optional[str] = None,
|
||||
) -> models.Filament:
|
||||
"""Add a new filament to the database."""
|
||||
vendor_item: Optional[models.Vendor] = None # noqa: FA100
|
||||
vendor_item: Optional[models.Vendor] = None
|
||||
if vendor_id is not None:
|
||||
vendor_item = await vendor.get_by_id(db, vendor_id)
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ async def find(
|
||||
# Since the archived field is nullable, and default is false, we need to check for both false or null
|
||||
stmt = stmt.where(
|
||||
sqlalchemy.or_(
|
||||
models.Spool.archived.is_(False), # noqa: FBT003
|
||||
models.Spool.archived.is_(False),
|
||||
models.Spool.archived.is_(None),
|
||||
),
|
||||
)
|
||||
|
||||
@@ -190,9 +190,9 @@ def is_debug_mode() -> bool:
|
||||
bool: Whether debug mode is enabled.
|
||||
"""
|
||||
debug_mode = os.getenv("SPOOLMAN_DEBUG_MODE", "FALSE").upper()
|
||||
if debug_mode == "FALSE" or debug_mode == "0":
|
||||
if debug_mode in {"FALSE", "0"}:
|
||||
return False
|
||||
if debug_mode == "TRUE" or debug_mode == "1":
|
||||
if debug_mode in {"TRUE", "1"}:
|
||||
return True
|
||||
raise ValueError(f"Failed to parse SPOOLMAN_DEBUG_MODE variable: Unknown debug mode '{debug_mode}'.")
|
||||
|
||||
@@ -206,9 +206,9 @@ def is_automatic_backup_enabled() -> bool:
|
||||
bool: Whether automatic backup is enabled.
|
||||
"""
|
||||
automatic_backup = os.getenv("SPOOLMAN_AUTOMATIC_BACKUP", "TRUE").upper()
|
||||
if automatic_backup == "FALSE" or automatic_backup == "0":
|
||||
if automatic_backup in {"FALSE", "0"}:
|
||||
return False
|
||||
if automatic_backup == "TRUE" or automatic_backup == "1":
|
||||
if automatic_backup in {"TRUE", "1"}:
|
||||
return True
|
||||
raise ValueError(
|
||||
f"Failed to parse SPOOLMAN_AUTOMATIC_BACKUP variable: Unknown automatic backup '{automatic_backup}'.",
|
||||
|
||||
Reference in New Issue
Block a user