-
Notifications
You must be signed in to change notification settings - Fork 3
MLE-23398 Updated copyright and version and NOTICE #119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
# Copyright (c) 2023-2025 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved. | ||
|
||
|
||
import json | ||
from collections import OrderedDict | ||
from email.message import Message | ||
|
@@ -263,15 +266,11 @@ def _extract_values_from_header(part) -> dict: | |
Returns a dict containing values about the document content or metadata. | ||
""" | ||
encoding = part.encoding | ||
disposition = part.headers["Content-Disposition".encode(encoding)].decode( | ||
encoding | ||
) | ||
disposition = part.headers["Content-Disposition".encode(encoding)].decode(encoding) | ||
|
||
content_type = None | ||
if part.headers.get("Content-Type".encode(encoding)): | ||
content_type = part.headers["Content-Type".encode(encoding)].decode( | ||
encoding | ||
) | ||
content_type = part.headers["Content-Type".encode(encoding)].decode(encoding) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line formatting change appears unrelated to the copyright update purpose of this PR. Code formatting changes should be separated from copyright updates to maintain clear change attribution. Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||
|
||
content_disposition_header = part.headers[ | ||
"Content-Disposition".encode(encoding) | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,3 +1,6 @@ | ||||||
# Copyright (c) 2023-2025 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved. | ||||||
|
||||||
|
||||||
""" | ||||||
Supports encoding and decoding vectors using the same approach as the vec:base64-encode and vec:base64-decode | ||||||
functions supported by the MarkLogic server. | ||||||
|
@@ -26,9 +29,7 @@ def base64_decode(encoded_vector: str) -> List[float]: | |||||
""" | ||||||
buffer = base64.b64decode(encoded_vector) | ||||||
if len(buffer) < 8: | ||||||
raise ValueError( | ||||||
"Buffer is too short to contain version and dimensions." | ||||||
) | ||||||
raise ValueError("Buffer is too short to contain version and dimensions.") | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line formatting change appears unrelated to the copyright update purpose of this PR. Code formatting changes should be separated from copyright updates to maintain clear change attribution. Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||
version, dimensions = struct.unpack("<ii", buffer[:8]) | ||||||
if version != 0: | ||||||
raise ValueError(f"Unsupported vector version: {version}") | ||||||
|
@@ -37,7 +38,5 @@ def base64_decode(encoded_vector: str) -> List[float]: | |||||
raise ValueError( | ||||||
f"Buffer is too short for the specified dimensions: expected {expected_length}, got {len(buffer)}" | ||||||
) | ||||||
floats = struct.unpack( | ||||||
"<" + "f" * dimensions, buffer[8 : 8 + 4 * dimensions] | ||||||
) | ||||||
floats = struct.unpack("<" + "f" * dimensions, buffer[8 : 8 + 4 * dimensions]) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line formatting change appears unrelated to the copyright update purpose of this PR. Code formatting changes should be separated from copyright updates to maintain clear change attribution.
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||
return list(floats) |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,3 +1,6 @@ | ||||||
# Copyright (c) 2023-2025 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved. | ||||||
|
||||||
|
||||||
from requests import Response | ||||||
|
||||||
from marklogic import Client | ||||||
|
@@ -139,7 +142,7 @@ def test_read_with_basic_client(basic_client: Client): | |||||
|
||||||
def test_read_with_original_response(basic_client: Client): | ||||||
response = basic_client.documents.read("/doc1.json", return_response=True) | ||||||
assert b'--ML_BOUNDARY' in response.content | ||||||
assert b"--ML_BOUNDARY" in response.content | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This quote style change from single to double quotes appears unrelated to the copyright update purpose of this PR. Code formatting changes should be separated from copyright updates to maintain clear change attribution.
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||
assert b'filename="/doc1.json"' in response.content | ||||||
assert b'{"hello":"world"}' in response.content | ||||||
|
||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,3 +1,6 @@ | ||||||
# Copyright (c) 2023-2025 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved. | ||||||
|
||||||
|
||||||
import json | ||||||
|
||||||
from requests import Response | ||||||
|
@@ -126,15 +129,11 @@ def test_not_rest_user(not_rest_user_client: Client): | |||||
|
||||||
def test_version_id(client: Client): | ||||||
equalSignEtag = ( | ||||||
client.get("v1/documents?uri=/doc2=copy.xml") | ||||||
.headers["ETag"] | ||||||
.replace('"', "") | ||||||
client.get("v1/documents?uri=/doc2=copy.xml").headers["ETag"].replace('"', "") | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line formatting change appears unrelated to the copyright update purpose of this PR. Code formatting changes should be separated from copyright updates to maintain clear change attribution.
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||
) | ||||||
|
||||||
semicolonEtag = ( | ||||||
client.get("v1/documents?uri=/doc2;copy.xml") | ||||||
.headers["ETag"] | ||||||
.replace('"', "") | ||||||
client.get("v1/documents?uri=/doc2;copy.xml").headers["ETag"].replace('"', "") | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line formatting change appears unrelated to the copyright update purpose of this PR. Code formatting changes should be separated from copyright updates to maintain clear change attribution. Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||
) | ||||||
|
||||||
docs = client.documents.search( | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line formatting change appears unrelated to the copyright update purpose of this PR. Code formatting changes should be separated from copyright updates to maintain clear change attribution.
Copilot uses AI. Check for mistakes.