code stringlengths 3 6.57k |
|---|
print(answer) |
aocd.submit(answer, part='b', day=DAY, year=YEAR) |
main() |
Simple
("https://oeo.net", ["foo", "/foo"], "https://oeo.net/foo") |
slash
("https://oeo.net", ["foo/", "/foo/"], "https://oeo.net/foo/") |
Deeper
("https://oeo.net/api/v04", ["foo/bar", "/foo/bar"], "https://oeo.net/api/v04/foo/bar") |
test_rest_api_connection_url_handling(requests_mock, base, paths, expected_path) |
RestApiConnection(base) |
requests_mock.get(expected_path, text="payload") |
requests_mock.post(expected_path, text="payload") |
conn.get(path) |
conn.post(path, {"foo": "bar"}) |
test_rest_api_headers() |
RestApiConnection(API_URL) |
requests_mock.Mocker() |
text(request, context) |
startswith("openeo-python-client") |
m.get("/foo", text=text) |
m.post("/foo", text=text) |
conn.get("/foo", headers={"X-Openeo-Bar": "XY123"}) |
conn.post("/foo", {}, headers={"X-Openeo-Bar": "XY123"}) |
test_connection_with_session() |
mock.Mock() |
Connection("https://oeo.net/", session=session) |
conn.capabilities() |
test_connect_with_session() |
mock.Mock() |
connect("https://oeo.net/", session=session) |
conn.capabilities() |
test_api_error(requests_mock) |
Connection(API_URL) |
pytest.raises(OpenEoApiError) |
conn.describe_collection("foobar") |
test_api_error_non_json(requests_mock) |
Connection(API_URL) |
requests_mock.get('https://oeo.net/collections/foobar', status_code=500, text="olapola") |
pytest.raises(OpenEoApiError) |
conn.describe_collection("foobar") |
test_authenticate_basic(requests_mock) |
Connection(API_URL) |
text_callback(request, context) |
requests_mock.get('https://oeo.net/credentials/basic', text=text_callback) |
isinstance(conn.auth, NullAuth) |
conn.authenticate_basic(username="john", password="j0hn") |
isinstance(conn.auth, BearerAuth) |
test_authenticate_oidc(oidc_test_setup) |
oidc_test_setup(client_id=client_id, oidc_discovery_url=oidc_discovery_url) |
Connection(API_URL) |
isinstance(conn.auth, NullAuth) |
conn.authenticate_OIDC(client_id=client_id, webbrowser_open=webbrowser_open) |
isinstance(conn.auth, BearerAuth) |
test_load_collection_arguments(requests_mock) |
Connection(API_URL) |
requests_mock.get(API_URL, json={"version": "0.4.0"}) |
logging.getLogger("yufuquantsdk") |
__init__(self, uri: str, ws: websockets.WebSocketClientProtocol = None) |
set() |
asyncio.Queue() |
asyncio.Queue(maxsize=100) |
asyncio.get_event_loop() |
self._run() |
auth(self, api_key: str) |
self._deliver(json.dumps(message) |
sub(self, topics: Iterable[str]) |
isinstance(topics, set) |
set(topics) |
list(topics) |
self._deliver(json.dumps(message) |
unsub(self, topics: Iterable[str]) |
isinstance(topics, set) |
set(topics) |
list(topics) |
self._deliver(json.dumps(message) |
robot_ping(self) |
int(datetime.now() |
timestamp() |
self._broadcast(message) |
robot_log(self, text: str, level: str = "info") |
int(datetime.now() |
timestamp() |
self._broadcast(message) |
robot_position_store(self, positions) |
datetime.now() |
isoformat() |
self._broadcast(message) |
robot_order_store(self, orders) |
datetime.now() |
isoformat() |
self._broadcast(message) |
robot_strategy_store(self, data) |
datetime.now() |
isoformat() |
self._broadcast(message) |
_connect(self, **kwargs) |
range(3) |
websockets.connect(self._uri, **kwargs) |
logger.exception("Failed to connect to %s: %s.", self._uri, exc) |
asyncio.sleep(10) |
logger.info("Connected to %s.", self._uri) |
_reconnect(self) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.