From 7bc8d2da91e590a6a354c43cd1cc0c1ab098ae9e Mon Sep 17 00:00:00 2001 From: Damir Modyarov Date: Tue, 8 Aug 2023 13:27:12 +0300 Subject: [PATCH] Lint service code --- redirect/db/models.py | 3 ++- redirect/settings.py | 8 ++++---- redirect/util.py | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/redirect/db/models.py b/redirect/db/models.py index f06a392..0da6b25 100644 --- a/redirect/db/models.py +++ b/redirect/db/models.py @@ -1,10 +1,11 @@ -from sqlalchemy import Boolean, Column, Integer, String, DateTime +from sqlalchemy import Boolean, Column, DateTime, Integer, String from redirect.db import Base class Link(Base): """Model of a short link that defines slug and target of a redirect.""" + __tablename__ = "short_link" id = Column(Integer, primary_key=True, index=True) diff --git a/redirect/settings.py b/redirect/settings.py index e9f6983..9e63468 100644 --- a/redirect/settings.py +++ b/redirect/settings.py @@ -10,10 +10,10 @@ class AppSettings(BaseSettings): database_url: str = "postgresql://postgres:postgres@127.0.0.1:5432/akarpov" class Config: - env_prefix = '' - env_file = '.env' - env_file_encoding = 'utf-8' - extra = 'allow' + env_prefix = "" + env_file = ".env" + env_file_encoding = "utf-8" + extra = "allow" settings = AppSettings() diff --git a/redirect/util.py b/redirect/util.py index 12d4c09..b02d7ac 100644 --- a/redirect/util.py +++ b/redirect/util.py @@ -10,7 +10,7 @@ def slug_to_link_id(slug: str) -> int: """Converts given slug to an id of a link.""" link_id = 0 try: - for i, ch in enumerate(slug[:SLUG_CUTOFF - 1:-1]): + for i, ch in enumerate(slug[:SLUG_CUTOFF - 1:-1]): # fmt: skip value = URL_CHARACTERS.index(ch) link_id += value * len(URL_CHARACTERS) ** i except ValueError: