Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
womullan committed Feb 27, 2024
1 parent db6db3e commit 3826d9b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
4 changes: 2 additions & 2 deletions python/lsst/consdb/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ def query(
raise e
try:
response.raise_for_status()
except:
except Exception as ex:
print(response.content.decode())
raise
raise ex
arr = response.json()
return DataFrame(arr[1:], columns=arr[0])

Expand Down
8 changes: 5 additions & 3 deletions python/lsst/consdb/header_proc.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import httpx
import kafkit
from lsst.resources import ResourcePath
from sqlalchemy import create_engine, text
from sqlalchemy import create_engine

if TYPE_CHECKING:
import lsst.resources
Expand All @@ -30,9 +30,11 @@
def process_resource(resource: lsst.resources.ResourcePath) -> None:
content = json.loads(resource.read())
with engine.begin() as conn:
print(conn)
# TODO get all fields and tables, do as a transaction
# conn.execute(
# text("INSERT INTO exposure (a, b, c, d, e)" " VALUES(:a, :b, :c, :d, :e)"),
# text("INSERT INTO exposure (a, b, c, d, e)"
# " VALUES(:a, :b, :c, :d, :e)"),
# [dict(a=content["something"], b=2, c=3, d=4, e=5)],
# )
print(f"Processing {resource}: {content[0:100]}")
Expand All @@ -51,7 +53,7 @@ async def main() -> None:
consumer = aiokafka.AIOKafkaConsumer(
topic,
bootstrap_servers=kafka_cluster,
group_id=kafka_group_id,
group_id=str(kafka_group_id),
auto_offset_reset="earliest",
)
await consumer.start()
Expand Down
10 changes: 5 additions & 5 deletions python/lsst/consdb/hinfo-latiss.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ def logical_or(*bools: Iterable[int | str | None]) -> bool:
}

TOPIC_MAPPING = {
"LATISS": "ATHeaderService",
"LSSTComCam": "CCHeaderService",
"LSSTCam": "MTHeaderService",
"LATISS": "ATHeaderService",
"LSSTComCam": "CCHeaderService",
"LSSTCam": "MTHeaderService",
}


Expand All @@ -111,10 +111,10 @@ def logical_or(*bools: Iterable[int | str | None]) -> bool:


def process_keyword(keyword: str | tuple, info: dict) -> Any:
if type(keyword) == str:
if type(keyword) is str:
if keyword in info:
return info[keyword]
elif type(keyword) == tuple:
elif type(keyword) is tuple:
fn = keyword[0]
args = keyword[1:]
if all([a in info for a in args]):
Expand Down
3 changes: 1 addition & 2 deletions python/lsst/consdb/server.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from flask import Flask, request
from sqlalchemy import create_engine, MetaData, Table
from sqlalchemy.dialects.postgresql import insert
from sqlalchemy import create_engine, MetaData
import sqlalchemy.exc


Expand Down

0 comments on commit 3826d9b

Please sign in to comment.