Skip to content
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
152 changes: 0 additions & 152 deletions .basedpyright/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -1060,24 +1060,6 @@
}
}
],
"./monitoring/mock_uss/dynamic_configuration/routes.py": [
{
"code": "reportReturnType",
"range": {
"startColumn": 11,
"endColumn": 5,
"lineCount": 3
}
},
{
"code": "reportReturnType",
"range": {
"startColumn": 11,
"endColumn": 5,
"lineCount": 3
}
}
],
"./monitoring/mock_uss/f3548v21/flight_planning.py": [
{
"code": "reportOperatorIssue",
Expand Down Expand Up @@ -1426,32 +1408,6 @@
}
}
],
"./monitoring/mock_uss/geoawareness/routes_geoawareness.py": [
{
"code": "reportReturnType",
"range": {
"startColumn": 11,
"endColumn": 48,
"lineCount": 1
}
},
{
"code": "reportReturnType",
"range": {
"startColumn": 11,
"endColumn": 57,
"lineCount": 1
}
},
{
"code": "reportReturnType",
"range": {
"startColumn": 11,
"endColumn": 51,
"lineCount": 1
}
}
],
"./monitoring/mock_uss/geoawareness/routes_geospatial_map.py": [
{
"code": "reportArgumentType",
Expand Down Expand Up @@ -1516,24 +1472,6 @@
}
}
],
"./monitoring/mock_uss/riddp/routes_behavior.py": [
{
"code": "reportReturnType",
"range": {
"startColumn": 11,
"endColumn": 37,
"lineCount": 1
}
},
{
"code": "reportReturnType",
"range": {
"startColumn": 11,
"endColumn": 43,
"lineCount": 1
}
}
],
"./monitoring/mock_uss/riddp/routes_observation.py": [
{
"code": "reportOptionalMemberAccess",
Expand Down Expand Up @@ -1766,14 +1704,6 @@
"endColumn": 87,
"lineCount": 1
}
},
{
"code": "reportReturnType",
"range": {
"startColumn": 11,
"endColumn": 32,
"lineCount": 1
}
}
],
"./monitoring/mock_uss/ridsp/behavior.py": [
Expand Down Expand Up @@ -1810,24 +1740,6 @@
}
}
],
"./monitoring/mock_uss/ridsp/routes_behavior.py": [
{
"code": "reportReturnType",
"range": {
"startColumn": 11,
"endColumn": 37,
"lineCount": 1
}
},
{
"code": "reportReturnType",
"range": {
"startColumn": 11,
"endColumn": 43,
"lineCount": 1
}
}
],
"./monitoring/mock_uss/ridsp/routes_injection.py": [
{
"code": "reportOperatorIssue",
Expand All @@ -1853,14 +1765,6 @@
"lineCount": 1
}
},
{
"code": "reportReturnType",
"range": {
"startColumn": 15,
"endColumn": 38,
"lineCount": 1
}
},
{
"code": "reportOptionalMemberAccess",
"range": {
Expand Down Expand Up @@ -1892,62 +1796,6 @@
"endColumn": 120,
"lineCount": 1
}
},
{
"code": "reportReturnType",
"range": {
"startColumn": 19,
"endColumn": 42,
"lineCount": 1
}
},
{
"code": "reportReturnType",
"range": {
"startColumn": 11,
"endColumn": 5,
"lineCount": 3
}
},
{
"code": "reportReturnType",
"range": {
"startColumn": 12,
"endColumn": 86,
"lineCount": 1
}
},
{
"code": "reportReturnType",
"range": {
"startColumn": 12,
"endColumn": 77,
"lineCount": 1
}
},
{
"code": "reportReturnType",
"range": {
"startColumn": 16,
"endColumn": 82,
"lineCount": 1
}
},
{
"code": "reportReturnType",
"range": {
"startColumn": 12,
"endColumn": 13,
"lineCount": 3
}
},
{
"code": "reportReturnType",
"range": {
"startColumn": 11,
"endColumn": 27,
"lineCount": 1
}
}
],
"./monitoring/mock_uss/ridsp/routes_ridsp_v19.py": [
Expand Down
2 changes: 1 addition & 1 deletion monitoring/mock_uss/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class Database(ImplicitDict):
"""Timestamp of most recent time periodic task loop iterated"""


db = SynchronizedValue(
db = SynchronizedValue[Database](
Database(
one_time_tasks=[],
task_errors=[],
Expand Down
6 changes: 3 additions & 3 deletions monitoring/mock_uss/dynamic_configuration/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class DynamicConfiguration(ImplicitDict):
locale: LocalityCode


db = SynchronizedValue(
db = SynchronizedValue[DynamicConfiguration](
DynamicConfiguration(locale=LocalityCode(webapp.config[KEY_BEHAVIOR_LOCALITY])),
decoder=lambda b: ImplicitDict.parse(
json.loads(b.decode("utf-8")), DynamicConfiguration
Expand All @@ -24,6 +24,6 @@ class DynamicConfiguration(ImplicitDict):


def get_locality() -> Locality:
with db as tx:
code = tx.locale
with db.transact() as tx:
code = tx.value.locale
return Locality.from_locale(code)
8 changes: 4 additions & 4 deletions monitoring/mock_uss/dynamic_configuration/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@


@webapp.route("/configuration/locality", methods=["GET"])
def locality_get() -> tuple[str, int]:
def locality_get() -> flask.Response:
return flask.jsonify(
GetLocalityResponse(locality_code=get_locality().locality_code())
)


@webapp.route("/configuration/locality", methods=["PUT"])
@requires_scope(MOCK_USS_CONFIG_SCOPE) # TODO: use separate public key for this
def locality_set() -> tuple[str, int]:
def locality_set() -> tuple[str, int] | flask.Response:
"""Set the locality of the mock_uss."""
try:
json = flask.request.json
Expand All @@ -38,8 +38,8 @@ def locality_set() -> tuple[str, int]:
msg = f"Invalid locality_code: {str(e)}"
return msg, 400

with db as tx:
tx.locale = req.locality_code
with db.transact() as tx:
tx.value.locale = req.locality_code

return flask.jsonify(
GetLocalityResponse(locality_code=get_locality().locality_code())
Expand Down
11 changes: 8 additions & 3 deletions monitoring/mock_uss/geoawareness/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
GeozoneSourceResponseResult,
)

from monitoring.mock_uss.geoawareness.database import Database, SourceRecord, db
from monitoring.mock_uss.geoawareness import database
from monitoring.mock_uss.geoawareness.database import SourceRecord, db
from monitoring.mock_uss.geoawareness.ed269 import evaluate_source

logger = logging.getLogger(__name__)
Expand All @@ -27,7 +28,7 @@ def combine_results(


def check_geozones(req: GeozonesCheckRequest) -> list[GeozonesCheckResultGeozone]:
sources: dict[str, SourceRecord] = Database.get_sources(db)
sources: dict[str, SourceRecord] = database.get_sources(db)

results: list[GeozonesCheckResultGeozone] = [
GeozonesCheckResultGeozone.Absent
Expand All @@ -44,7 +45,11 @@ def check_geozones(req: GeozonesCheckRequest) -> list[GeozonesCheckResultGeozone
)
continue

fmt = source.definition.https_source.format
fmt = (
source.definition.https_source.format
if source.definition.https_source
else None
)
if fmt == GeozoneHttpsSourceFormat.ED_269:
logger.debug(f" {j + 1}. ED269 source {source_id} ready.")
result = combine_results(
Expand Down
Loading
Loading