mirror of
https://github.com/Alexander-D-Karpov/akarpov
synced 2025-04-19 10:31:59 +03:00
Lint service code
This commit is contained in:
parent
e1959f7232
commit
7bc8d2da91
|
@ -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)
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue
Block a user