Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: enforce using double quotes #18

Merged
merged 1 commit into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
# stop the build if there are Python syntax errors or undefined names
poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --inline-quotes='double' --statistics
- name: Run mypy
run: |
poetry run mypy --strict .
Expand Down
4 changes: 2 additions & 2 deletions alembic/versions/2b65d99108d5_seed_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@


# revision identifiers, used by Alembic.
revision = '2b65d99108d5'
down_revision = '602af0699ee9'
revision = "2b65d99108d5"
down_revision = "602af0699ee9"
branch_labels = None
depends_on = None

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from alembic import op

# revision identifiers, used by Alembic.
revision = '602af0699ee9'
revision = "602af0699ee9"
down_revision = None
branch_labels = None
depends_on = None
Expand Down
32 changes: 31 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions pyfastapi/utils/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def init_logger() -> None:
"""
Initialize logger, has to be run first above all
"""
formatter = ColourizedFormatter(fmt='%(levelprefix)s [%(asctime)s] %(name)s - %(message)s', use_colors=True)
formatter = ColourizedFormatter(fmt="%(levelprefix)s [%(asctime)s] %(name)s - %(message)s", use_colors=True)
handler = logging.StreamHandler(sys.stdout)
handler.setFormatter(formatter)
logging.basicConfig(
Expand All @@ -26,7 +26,7 @@ def configure_log(uvicorn_log_config: Dict[str, Any]) -> Dict[str, Any]:
Configure log of uvicorn
Get the default uvicorn_log_config and then override the formatter
"""
formatters = uvicorn_log_config['formatters']
formatters['default']['fmt'] = '%(levelprefix)s [%(asctime)s] %(message)s'
formatters['access']['fmt'] = '%(levelprefix)s [%(asctime)s] %(client_addr)s - "%(request_line)s" %(status_code)s'
formatters = uvicorn_log_config["formatters"]
formatters["default"]["fmt"] = "%(levelprefix)s [%(asctime)s] %(message)s"
formatters["access"]["fmt"] = "%(levelprefix)s [%(asctime)s] %(client_addr)s - '%(request_line)s' %(status_code)s"
return uvicorn_log_config
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ flake8 = "^7.0.0"
faker = "^22.6.0"
coverage = "^7.4.1"
mypy = "^1.8.0"
flake8-quotes = "^3.4.0"

[build-system]
requires = ["poetry-core"]
Expand Down
10 changes: 5 additions & 5 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ def init_db() -> Iterator[None]:
config = Config()
config.set_main_option("sqlalchemy.url", AppConfig.DB_HOST)
config.set_main_option("script_location", "alembic")
command.upgrade(config, 'head')
command.upgrade(config, "head")
yield None
command.downgrade(config, 'base')
command.downgrade(config, "base")


# faker fixtures below
@fixture(scope='session', autouse=True)
@fixture(scope="session", autouse=True)
def faker_session_locale() -> List[str]:
return ['en_US']
return ["en_US"]


@fixture(scope='session', autouse=True)
@fixture(scope="session", autouse=True)
def faker_seed() -> int:
return 12345
Loading