Skip to content

Commit

Permalink
flake8
Browse files Browse the repository at this point in the history
  • Loading branch information
womullan committed Feb 27, 2024
1 parent 22547b7 commit db6db3e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
8 changes: 4 additions & 4 deletions python/lsst/consdb/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def insert(table: str, values: dict[str, Any], **kwargs):
url = urljoin(base_url, "insert")
try:
response = requests.post(url, json=data)
except (RequestException) as e:
except RequestException as e:
raise e
response.raise_for_status()

Expand All @@ -36,8 +36,8 @@ def query(
data = {"tables": tables, "columns": columns, "where": where, "join": join}
try:
response = requests.post(url, json=data)
except (RequestException) as e:
raise e
except RequestException as e:
raise e
try:
response.raise_for_status()
except:
Expand All @@ -52,7 +52,7 @@ def schema(table: str):
url = urljoin(url, table)
try:
response = requests.get(url)
except (RequestException) as e:
except RequestException as e:
raise e
response.raise_for_status()
return response.json()
14 changes: 10 additions & 4 deletions python/lsst/consdb/hinfo-latiss.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,24 @@
# import Kafka interface



def ninety_minus(angle: float) -> float:
return 90.0 - angle


def tai_convert(t: str) -> datetime:
return Time(t, format="isot", scale="tai").datetime


def tai_mean(start: str, end: str) -> datetime:
s = Time(start, format="isot", scale="tai")
e = Time(end, format="isot", scale="tai")
return (s + (e - s) / 2).datetime


def mean(*iterable: Iterable[Any]) -> Any:
return sum(iterable) / len(iterable)


def logical_or(*bools: Iterable[int | str | None]) -> bool:
return any([b == 1 or b == "1" for b in bools])

Expand Down Expand Up @@ -77,8 +80,9 @@ def logical_or(*bools: Iterable[int | str | None]) -> bool:
"dome_azimuth": "DOMEAZ",
"shut_lower": "SHUTLOWR",
"shut_upper": "SHUTUPPR",
# "temp_set": "TEMP_SET",
"simulated": (logical_or, "SIMULATE ATMCS", "SIMULATE ATHEXAPOD", "SIMULAT ATPNEUMATICS", "SIMULATE ATDOME", "SIMULATE ATSPECTROGRAPH"),
# "temp_set": "TEMP_SET",
"simulated": (logical_or, "SIMULATE ATMCS", "SIMULATE ATHEXAPOD", "SIMULAT ATPNEUMATICS",
"SIMULATE ATDOME", "SIMULATE ATSPECTROGRAPH"),
}

# LATISS_DETECTOR_MAPPING = {
Expand Down Expand Up @@ -116,6 +120,7 @@ def process_keyword(keyword: str | tuple, info: dict) -> Any:
if all([a in info for a in args]):
return fn(*[info[a] for a in args])


def process_resource(resource: ResourcePath) -> None:
global engine, exposure_table

Expand Down Expand Up @@ -145,7 +150,8 @@ def process_resource(resource: ResourcePath) -> None:

stmt = insert(exposure_table).values(exposure_rec).on_conflict_do_nothing()
with engine.begin() as conn:
result = conn.execute(stmt)
conn.execute(stmt)
# result = conn.execute(stmt)

# print(exposure_rec)

Expand Down

0 comments on commit db6db3e

Please sign in to comment.