Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
# Conflicts:
#	shell.nix
#	uv.lock
  • Loading branch information
Zaczero committed Dec 29, 2024
2 parents 335317c + 906b454 commit fb9a952
Show file tree
Hide file tree
Showing 6 changed files with 222 additions and 235 deletions.
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 4
max_line_length = 120
insert_final_newline = true
trim_trailing_whitespace = true

[*.{json,toml,yaml,nix}]
indent_size = 2

[*.md]
max_line_length = off
9 changes: 5 additions & 4 deletions api/v1/photos.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,13 @@ async def upload(
return Response(f'Unsupported file type {content_type!r}, must be one of {IMAGE_CONTENT_TYPES}', 400)

try:
oauth2_credentials_: dict = json.loads(oauth2_credentials)
oauth2_token = SecretStr(oauth2_credentials_['access_token'])
except Exception:
oauth2_credentials_dict: dict = json.loads(oauth2_credentials)
except json.JSONDecodeError:
return Response('OAuth2 credentials must be a JSON object', 400)
if 'access_token' not in oauth2_credentials_:
if 'access_token' not in oauth2_credentials_dict:
return Response('OAuth2 credentials must contain an access_token field', 400)
oauth2_token = SecretStr(oauth2_credentials_dict['access_token'])
del oauth2_credentials_dict

aed = await AEDService.get_by_id(node_id)
if aed is None:
Expand Down
1 change: 1 addition & 0 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
dsn=SENTRY_DSN,
release=VERSION,
environment=ENVIRONMENT,
keep_alive=True,
enable_tracing=True,
traces_sample_rate=0.2,
trace_propagation_targets=None,
Expand Down
103 changes: 48 additions & 55 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
[project]
# TODO: add aiohttp[speedups] after https://github.com/saghul/pycares/pull/202
dependencies = [
"alembic",
"anyio",
Expand All @@ -21,7 +20,7 @@ dependencies = [
"python-multipart",
"pytz",
"scikit-learn",
"sentry-sdk[fastapi,httpx,sqlalchemy,pure_eval]",
"sentry-sdk[fastapi,httpx,sqlalchemy]",
"shapely",
"sqlalchemy[postgresql-asyncpg]",
"starlette-compress",
Expand Down Expand Up @@ -81,79 +80,73 @@ ignore = [
"ARG002", # unused-method-argument
"COM812", # missing-trailing-comma
"COM819", # prohibited-trailing-comma
"D206", # indent-with-spaces
"D300", # triple-single-quotes
"E111", # indentation-with-invalid-multiple
"E114", # indentation-with-invalid-multiple-comment
"E117", # over-indented
"E501", # line-too-long
"D206", # indent-with-spaces
"D300", # triple-single-quotes
"E111", # indentation-with-invalid-multiple
"E114", # indentation-with-invalid-multiple-comment
"E117", # over-indented
"E501", # line-too-long
"ISC001", # single-line-implicit-string-concatenation
"ISC002", # multi-line-implicit-string-concatenation
"Q000", # bad-quotes-inline-string
"Q001", # bad-quotes-multiline-string
"Q002", # bad-quotes-docstring
"Q003", # avoidable-escaped-quote
"Q000", # bad-quotes-inline-string
"Q001", # bad-quotes-multiline-string
"Q002", # bad-quotes-docstring
"Q003", # avoidable-escaped-quote
"SIM108", # if-else-block-instead-of-if-exp
"TRY003", # raise-vanilla-args
"W191", # tab-indentation
"W191", # tab-indentation
]
# see https://docs.astral.sh/ruff/rules/ for rules documentation
select = [
"A", # flake8-builtins
"ARG", # flake8-unused-arguments
"A", # flake8-builtins
"ARG", # flake8-unused-arguments
"ASYNC", # flake8-async
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"DTZ", # flake8-datetimez
"E4", # pycodestyle
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"DTZ", # flake8-datetimez
"E4", # pycodestyle
"E7",
"E9",
"F", # pyflakes
"FA", # flake8-future-annotations
"FLY", # flynt # "FURB", # refurb
"G", # flake8-logging-format
"I", # isort
"ICN", # flake8-import-conventions
"INT", # flake8-gettext
"ISC", # flake8-implicit-str-concat
"LOG", # flake8-logging
"N", # pep8-naming
"NPY", # numpy
"PERF", # perflint
"PGH", # pygrep-hooks
"PIE", # flake8-pie
"PT", # flake8-pytest-style
"PTH", # flake8-use-pathlib
"PYI", # flake8-pyi
"Q", # flake8-quotes
"RSE", # flake8-raise
"RUF", # ruff
"S", # flake8-bandit
"SIM", # flake8-simplify
"SLF", # flake8-self
"SLOT", # flake8-slots
"T10", # flake8-debugger
"T20", # flake8-print
"TID", # flake8-tidy-imports
"TRY", # tryceratops
"UP", # pyupgrade
"F", # pyflakes
"FA", # flake8-future-annotations
"FLY", # flynt # "FURB", # refurb
"G", # flake8-logging-format
"I", # isort
"ICN", # flake8-import-conventions
"INT", # flake8-gettext
"ISC", # flake8-implicit-str-concat
"LOG", # flake8-logging
"N", # pep8-naming
"NPY", # numpy
"PERF", # perflint
"PGH", # pygrep-hooks
"PIE", # flake8-pie
"PT", # flake8-pytest-style
"PTH", # flake8-use-pathlib
"PYI", # flake8-pyi
"Q", # flake8-quotes
"RSE", # flake8-raise
"RUF", # ruff
"S", # flake8-bandit
"SIM", # flake8-simplify
"SLF", # flake8-self
"SLOT", # flake8-slots
"T10", # flake8-debugger
"T20", # flake8-print
"TID", # flake8-tidy-imports
"TRY", # tryceratops
"UP", # pyupgrade
"W6",
"YTT", # flake8-2020
"YTT", # flake8-2020
]

fixable = ["ALL"]
unfixable = []

[tool.ruff.format]
quote-style = "single"

# Like Black, indent with spaces, rather than tabs.
indent-style = "space"

# Like Black, respect magic trailing commas.
skip-magic-trailing-comma = false

# Like Black, automatically detect the appropriate line ending.
line-ending = "lf"

[tool.ruff.lint.flake8-builtins]
Expand Down
6 changes: 4 additions & 2 deletions shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

let
# Update packages with `nixpkgs-update` command
pkgs = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/31d66ae40417bb13765b0ad75dd200400e98de84.tar.gz") { };
pkgs = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/0fcb98acb6633445764dafe180e6833eb0f95208.tar.gz") { };

pythonLibs = with pkgs; [
stdenv.cc.cc.lib
file.out
libxml2.out
zlib.out
stdenv.cc.cc.lib
];
python' = with pkgs; (symlinkJoin {
name = "python";
Expand Down Expand Up @@ -128,7 +128,9 @@ let
];

shell' = with pkgs; lib.optionalString isDevelopment ''
export SSL_CERT_FILE=${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt
export PYTHONNOUSERSITE=1
export PYTHONPATH=""
export TZ=UTC
current_python=$(readlink -e .venv/bin/python || echo "")
Expand Down
Loading

0 comments on commit fb9a952

Please sign in to comment.