Skip to content

Commit

Permalink
fix: linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
stevegerrits committed Feb 27, 2024
1 parent 2497525 commit 6d7efa1
Show file tree
Hide file tree
Showing 15 changed files with 225 additions and 46 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ RUN --mount=type=cache,target=/root/.cache/pypoetry/ \
poetry install --only main --no-interaction --no-ansi

COPY . .
RUN chmod +x manage.py

ENTRYPOINT ["/opt/vespadb-env/bin/poe"]
CMD ["serve"]
Expand Down
1 change: 1 addition & 0 deletions __init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""."""
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ target-version = "py311"
force-exclude = true # https://docs.astral.sh/ruff/settings/#force-exclude
preview = true # https://docs.astral.sh/ruff/preview/


[tool.ruff.extend-per-file-ignores] # https://docs.astral.sh/ruff/settings/#extend-per-file-ignores
# Ignore missing __init__.py files in tests.
"tests/*" = ["INP001", "PLR2004"]
Expand Down
1 change: 1 addition & 0 deletions vespadb/nests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""."""
1 change: 0 additions & 1 deletion vespadb/nests/filters.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Filters for the Nest model."""

from django.contrib.gis.db import models
from rest_framework_gis.filterset import GeoFilterSet

from vespadb.nests.models import Nest
Expand Down
248 changes: 212 additions & 36 deletions vespadb/nests/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"""."""
# Generated by Django 5.0.2 on 2024-02-23 15:37

import django.contrib.gis.db.models.fields
Expand All @@ -7,6 +8,7 @@


class Migration(migrations.Migration):
"""."""

initial = True

Expand All @@ -16,45 +18,219 @@ class Migration(migrations.Migration):

operations = [
migrations.CreateModel(
name='Nest',
name="Nest",
fields=[
('id', models.AutoField(primary_key=True, serialize=False)),
('creation_datetime', models.DateTimeField(auto_now_add=True)),
('source', models.CharField(choices=[('OA', 'Observations API'), ('UR', 'User'), ('IM', 'Import')], default='OA', max_length=2)),
('status', models.CharField(choices=[('UT', 'Untreated'), ('TR', 'Treated')], default='UT', max_length=2)),
('validated', models.CharField(choices=[('YES', 'Yes'), ('NO', 'No'), ('UNK', 'Unknown')], default='UNK', max_length=3)),
('deleted', models.BooleanField(default=True)),
('last_modification_datetime', models.DateTimeField(auto_now=True)),
('reporter_phone_number', models.CharField(blank=True, max_length=20, null=True)),
('reporter_email', models.EmailField(max_length=254)),
('reported_datetime', models.DateTimeField()),
('extermination_datetime', models.DateTimeField(blank=True, null=True)),
('location', django.contrib.gis.db.models.fields.PointField(srid=4326)),
('address', models.CharField(blank=True, max_length=255, null=True)),
('images', models.JSONField(default=list)),
('nature_reserve', models.BooleanField()),
('nest_height', models.CharField(blank=True, choices=[('BL4', 'Below 4 meters'), ('AB4', 'Above 4 meters')], max_length=3, null=True)),
('nest_location', models.CharField(blank=True, choices=[('OUB', 'Outdoor, uncovered on building'), ('OUT', 'Outdoor, uncovered in tree or bush'), ('OCS', 'Outdoor, covered by structure'), ('ONC', 'Outdoor, naturally covered'), ('IIB', 'Indoor, in building or structure'), ('UNK', 'Unknown')], max_length=3, null=True)),
('remarks', models.TextField(blank=True, max_length=5000, null=True)),
('nest_type', models.CharField(blank=True, choices=[('AEM', 'Active embryonic nest'), ('APR', 'Active primary nest'), ('ASE', 'Active secondary nest'), ('IEM', 'Inactive/empty nest'), ('POT', 'Potential nest (more info needed)'), ('OSP', 'Nest of another species'), ('NON', 'No nest (object, insect)')], max_length=3, null=True)),
('feedback_provided', models.CharField(choices=[('YES', 'Yes'), ('NO', 'No'), ('UNK', 'Unknown')], default='UNK', max_length=3)),
('managed', models.CharField(choices=[('YES', 'Yes'), ('NO', 'No'), ('UNK', 'Unknown')], default='UNK', max_length=3)),
('duplicate', models.CharField(choices=[('YES', 'Yes'), ('NO', 'No'), ('UNK', 'Unknown')], default='UNK', max_length=3)),
('public_domain', models.CharField(choices=[('YES', 'Yes'), ('NO', 'No'), ('UNK', 'Unknown')], default='UNK', max_length=3)),
('result', models.CharField(choices=[('SUC', 'Successfully treated'), ('NST', 'Not successfully treated'), ('NTR', 'Not treated'), ('UNK', 'Unknown')], default='UNK', max_length=3)),
('problems', models.CharField(choices=[('NON', 'None'), ('STI', 'Stings'), ('NFAL', 'Nest fallen'), ('DIZ', 'Dizziness/nausea'), ('CHE', 'Chemical projection'), ('UNK', 'Unknown')], default='UNK', max_length=4)),
('care', models.CharField(choices=[('NFR', 'Nest fully removed'), ('NPR', 'Nest partially removed'), ('NLH', 'Nest left hanging'), ('UNK', 'Unknown')], default='UNK', max_length=3)),
('product', models.CharField(choices=[('PER', 'Permas-D'), ('LN', 'Liquid nitrogen'), ('VF', 'Vespa Ficam D'), ('TP', 'Topscore PAL'), ('EAE', 'Ether/aceton/ethyl acetate'), ('DE', 'Diatomaceous earth'), ('OTH', 'Other'), ('NON', 'None'), ('UNK', 'Unknown')], default='UNK', max_length=3)),
('method', models.CharField(choices=[('FRZ', 'Freezing'), ('TLP', 'Telescopic pole'), ('SC', 'Sealable container/box'), ('LS', 'Liquid sprayer'), ('PS', 'Powder sprayer'), ('NT', 'Not treated'), ('OTH', 'Other'), ('UNK', 'Unknown')], default='UNK', max_length=3)),
('extermination_file_number', models.CharField(blank=True, max_length=255, null=True)),
('extermination_photos', models.JSONField(default=list)),
('ANB_area', models.CharField(choices=[('YES', 'Yes'), ('NO', 'No'), ('UNK', 'Unknown')], default='UNK', max_length=3)),
('province', models.CharField(choices=[('WF', 'West Flanders'), ('EF', 'East Flanders'), ('ANT', 'Antwerp'), ('FB', 'Flemish Brabant'), ('LIM', 'Limburg'), ('NF', 'Non-Flemish'), ('UNK', 'Unknown')], default='UNK', max_length=3)),
('exterminator', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='nests_handled', to=settings.AUTH_USER_MODEL)),
("id", models.AutoField(primary_key=True, serialize=False)),
("creation_datetime", models.DateTimeField(auto_now_add=True)),
(
"source",
models.CharField(
choices=[("OA", "Observations API"), ("UR", "User"), ("IM", "Import")],
default="OA",
max_length=2,
),
),
(
"status",
models.CharField(choices=[("UT", "Untreated"), ("TR", "Treated")], default="UT", max_length=2),
),
(
"validated",
models.CharField(
choices=[("YES", "Yes"), ("NO", "No"), ("UNK", "Unknown")], default="UNK", max_length=3
),
),
("deleted", models.BooleanField(default=True)),
("last_modification_datetime", models.DateTimeField(auto_now=True)),
("reporter_phone_number", models.CharField(blank=True, max_length=20, null=True)),
("reporter_email", models.EmailField(max_length=254)),
("reported_datetime", models.DateTimeField()),
("extermination_datetime", models.DateTimeField(blank=True, null=True)),
("location", django.contrib.gis.db.models.fields.PointField(srid=4326)),
("address", models.CharField(blank=True, max_length=255, null=True)),
("images", models.JSONField(default=list)),
("nature_reserve", models.BooleanField()),
(
"nest_height",
models.CharField(
blank=True,
choices=[("BL4", "Below 4 meters"), ("AB4", "Above 4 meters")],
max_length=3,
null=True,
),
),
(
"nest_location",
models.CharField(
blank=True,
choices=[
("OUB", "Outdoor, uncovered on building"),
("OUT", "Outdoor, uncovered in tree or bush"),
("OCS", "Outdoor, covered by structure"),
("ONC", "Outdoor, naturally covered"),
("IIB", "Indoor, in building or structure"),
("UNK", "Unknown"),
],
max_length=3,
null=True,
),
),
("remarks", models.TextField(blank=True, max_length=5000, null=True)),
(
"nest_type",
models.CharField(
blank=True,
choices=[
("AEM", "Active embryonic nest"),
("APR", "Active primary nest"),
("ASE", "Active secondary nest"),
("IEM", "Inactive/empty nest"),
("POT", "Potential nest (more info needed)"),
("OSP", "Nest of another species"),
("NON", "No nest (object, insect)"),
],
max_length=3,
null=True,
),
),
(
"feedback_provided",
models.CharField(
choices=[("YES", "Yes"), ("NO", "No"), ("UNK", "Unknown")], default="UNK", max_length=3
),
),
(
"managed",
models.CharField(
choices=[("YES", "Yes"), ("NO", "No"), ("UNK", "Unknown")], default="UNK", max_length=3
),
),
(
"duplicate",
models.CharField(
choices=[("YES", "Yes"), ("NO", "No"), ("UNK", "Unknown")], default="UNK", max_length=3
),
),
(
"public_domain",
models.CharField(
choices=[("YES", "Yes"), ("NO", "No"), ("UNK", "Unknown")], default="UNK", max_length=3
),
),
(
"result",
models.CharField(
choices=[
("SUC", "Successfully treated"),
("NST", "Not successfully treated"),
("NTR", "Not treated"),
("UNK", "Unknown"),
],
default="UNK",
max_length=3,
),
),
(
"problems",
models.CharField(
choices=[
("NON", "None"),
("STI", "Stings"),
("NFAL", "Nest fallen"),
("DIZ", "Dizziness/nausea"),
("CHE", "Chemical projection"),
("UNK", "Unknown"),
],
default="UNK",
max_length=4,
),
),
(
"care",
models.CharField(
choices=[
("NFR", "Nest fully removed"),
("NPR", "Nest partially removed"),
("NLH", "Nest left hanging"),
("UNK", "Unknown"),
],
default="UNK",
max_length=3,
),
),
(
"product",
models.CharField(
choices=[
("PER", "Permas-D"),
("LN", "Liquid nitrogen"),
("VF", "Vespa Ficam D"),
("TP", "Topscore PAL"),
("EAE", "Ether/aceton/ethyl acetate"),
("DE", "Diatomaceous earth"),
("OTH", "Other"),
("NON", "None"),
("UNK", "Unknown"),
],
default="UNK",
max_length=3,
),
),
(
"method",
models.CharField(
choices=[
("FRZ", "Freezing"),
("TLP", "Telescopic pole"),
("SC", "Sealable container/box"),
("LS", "Liquid sprayer"),
("PS", "Powder sprayer"),
("NT", "Not treated"),
("OTH", "Other"),
("UNK", "Unknown"),
],
default="UNK",
max_length=3,
),
),
("extermination_file_number", models.CharField(blank=True, max_length=255, null=True)),
("extermination_photos", models.JSONField(default=list)),
(
"ANB_area",
models.CharField(
choices=[("YES", "Yes"), ("NO", "No"), ("UNK", "Unknown")], default="UNK", max_length=3
),
),
(
"province",
models.CharField(
choices=[
("WF", "West Flanders"),
("EF", "East Flanders"),
("ANT", "Antwerp"),
("FB", "Flemish Brabant"),
("LIM", "Limburg"),
("NF", "Non-Flemish"),
("UNK", "Unknown"),
],
default="UNK",
max_length=3,
),
),
(
"exterminator",
models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="nests_handled",
to=settings.AUTH_USER_MODEL,
),
),
],
options={
'verbose_name': 'Nest',
'verbose_name_plural': 'Nests',
"verbose_name": "Nest",
"verbose_name_plural": "Nests",
},
),
]
1 change: 1 addition & 0 deletions vespadb/nests/migrations/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""."""
1 change: 1 addition & 0 deletions vespadb/nests/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ class Nest(models.Model):
"""Model for a Vespa velutina nest."""

id = models.AutoField(primary_key=True)
external_id = models.CharField(max_length=255)
creation_datetime = models.DateTimeField(auto_now_add=True)
source = models.CharField(max_length=2, choices=SourceEnum.choices, default=SourceEnum.OBSERVATIONS_API)
status = models.CharField(max_length=2, choices=NestStatusEnum.choices, default=NestStatusEnum.UNTREATED)
Expand Down
3 changes: 1 addition & 2 deletions vespadb/nests/tests.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
from django.test import TestCase

"""."""
# Create your tests here.
2 changes: 1 addition & 1 deletion vespadb/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = ["0.0.0.0"] # type: ignore[var-annotated]
ALLOWED_HOSTS = ["0.0.0.0"] # noqa: S104

# Application definition
INSTALLED_APPS = [
Expand Down
1 change: 1 addition & 0 deletions vespadb/users/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""."""
3 changes: 1 addition & 2 deletions vespadb/users/admin.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
from django.contrib import admin

"""."""
# Register your models here.
1 change: 1 addition & 0 deletions vespadb/users/migrations/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""."""
3 changes: 1 addition & 2 deletions vespadb/users/models.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
from django.db import models

"""."""
# Create your models here.
3 changes: 1 addition & 2 deletions vespadb/users/tests.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
from django.test import TestCase

"""."""
# Create your tests here.

0 comments on commit 6d7efa1

Please sign in to comment.