Skip to content

Commit f5166f1

Browse files
committed
Accidentally removed '_get_visit_list'; removed duplicated 'posix_path'
1 parent a8ec52e commit f5166f1

File tree

2 files changed

+13
-15
lines changed

2 files changed

+13
-15
lines changed

src/murfey/client/__init__.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,6 @@
4242
log = logging.getLogger("murfey.client")
4343

4444

45-
def posix_path(path: Path) -> str:
46-
"""
47-
Converts a Windows-style path into a Posix one. Used primarily when running
48-
subproceses in bash terminals, which can only accept Posix paths.
49-
"""
50-
path_parts = list(path.parts)
51-
# Check if it's a Windows-style path
52-
if path_parts[0].endswith((":/", ":\\")):
53-
path_parts[0] = "/" + path_parts[0].strip(":/\\").lower()
54-
posix_path = "/".join(path_parts)
55-
return posix_path
56-
return str(path)
57-
58-
5945
def read_config() -> configparser.ConfigParser:
6046
config = configparser.ConfigParser()
6147
try:

src/murfey/util/__init__.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,14 @@
1313
from queue import Queue
1414
from threading import Thread
1515
from typing import Awaitable, Callable, Dict, List, Optional, Tuple, Union
16-
from urllib.parse import urlparse, urlunparse
16+
from urllib.parse import ParseResult, urlparse, urlunparse
1717
from uuid import uuid4
1818

1919
import requests
2020
from werkzeug.utils import secure_filename
2121

22+
from murfey.util.models import Visit
23+
2224
logger = logging.getLogger("murfey.util")
2325

2426

@@ -96,6 +98,16 @@ def posix_path(path: Path) -> str:
9698
return str(path)
9799

98100

101+
def _get_visit_list(api_base: ParseResult, instrument_name: str):
102+
get_visits_url = api_base._replace(
103+
path=f"/instruments/{instrument_name}/visits_raw"
104+
)
105+
server_reply = requests.get(get_visits_url.geturl())
106+
if server_reply.status_code != 200:
107+
raise ValueError(f"Server unreachable ({server_reply.status_code})")
108+
return [Visit.parse_obj(v) for v in server_reply.json()]
109+
110+
99111
def capture_post(url: str, json: dict | list = {}) -> requests.Response | None:
100112
try:
101113
response = requests.post(url, json=json)

0 commit comments

Comments
 (0)