Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions .github/workflows/update_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
from typing import Optional


def update_version(version_type: str = "dev", custom_suffix: Optional[str] = None) -> str:
def update_version(
version_type: str = "dev", custom_suffix: Optional[str] = None
) -> str:
"""
Update the `version` field in `pyproject.toml` for supported manual build types.

Expand All @@ -25,17 +27,21 @@ def update_version(version_type: str = "dev", custom_suffix: Optional[str] = Non
content: str = pyproject_path.read_text()

# Extract current version
version_match: Optional[re.Match[str]] = re.search(r'^version\s*=\s*"([^"]+)"', content, re.MULTILINE)
version_match: Optional[re.Match[str]] = re.search(
r'^version\s*=\s*"([^"]+)"', content, re.MULTILINE
)
if not version_match:
raise ValueError("Could not find version in pyproject.toml")

current_version: str = version_match.group(1)

# Parse the base version (remove any existing suffixes)
base_version_match: Optional[re.Match[str]] = re.match(r'^(\d+\.\d+\.\d+)', current_version)
base_version_match: Optional[re.Match[str]] = re.match(
r"^(\d+\.\d+\.\d+)", current_version
)
if not base_version_match:
raise ValueError(f"Invalid version format: {current_version}")

base_version: str = base_version_match.group(1)

# Only dev/custom builds mutate the version; all others keep current version
Expand Down
4 changes: 3 additions & 1 deletion docs/7_orm_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ class Edge1(

if input("Execute the DDL? (y/N)") == "y":
client.execute_py(graph_type.to_gql())
client.execute_py("CREATE GRAPH IF NOT EXISTS define_type_test define_type_test_type")
client.execute_py(
"CREATE GRAPH IF NOT EXISTS define_type_test define_type_test_type"
)


q = upsert_gql(
Expand Down
1 change: 1 addition & 0 deletions example.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ def sync_session_pool_example():
if __name__ == "__main__":
import asyncio
import logging

logging.basicConfig(level=logging.DEBUG)
logging.getLogger("nebulagraph_python").setLevel(logging.DEBUG)

Expand Down
1 change: 0 additions & 1 deletion scripts/add_apache_headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,4 +203,3 @@ def main() -> None:

if __name__ == "__main__":
main()

4 changes: 2 additions & 2 deletions src/nebulagraph_python/decoder/size_constant.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
BOOL_SIZE = 1
# Vector element size
EMBEDDING_VECTOR_DIM_SIZE = 4 # Size of vector dimension in row type (int32)
ELEMENT_NUMBER_SIZE_FOR_VECTOR_VALUE=2
EMBEDDING_VECTOR_FLOAT_VALUE_SIZE=4
ELEMENT_NUMBER_SIZE_FOR_VECTOR_VALUE = 2
EMBEDDING_VECTOR_FLOAT_VALUE_SIZE = 4
FLOAT32_SIZE = 4 # Size of each float32 element in vector

# String size: 4 byte string value length + 4 byte prefix string
Expand Down
2 changes: 1 addition & 1 deletion src/nebulagraph_python/orm/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from collections.abc import Sequence as ABCSequence
from dataclasses import dataclass
from datetime import date
from types import UnionType
from typing import Iterable
from collections.abc import Sequence as ABCSequence

from pydantic import (
AfterValidator,
Expand Down
5 changes: 4 additions & 1 deletion src/nebulagraph_python/py_data_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,7 @@ def __eq__(self, other) -> bool:
logger.warning("Expected Vector, got %s", type(other))
return False
return self.dimension == other.dimension and all(
abs(a - b) < 1e-7 for a, b in zip(self.values, other.values)
abs(a - b) < 1e-7 for a, b in zip(self.values, other.values, strict=True)
)

def __str__(self) -> str:
Expand All @@ -913,6 +913,9 @@ def __repr__(self) -> str:
"""Return detailed string representation of the vector."""
return f"NVector({self.values})"

def __hash__(self) -> int:
return hash(str(self))


BasicTargetType = Union[
None,
Expand Down
2 changes: 1 addition & 1 deletion src/nebulagraph_python/result_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ def as_ascii_table(
row_num = 1
for record in self.records():
console.print(f"\n[bold blue]Row {row_num}[/bold blue]")
for col, val in zip(self.column_names, record.values()):
for col, val in zip(self.column_names, record.values(), strict=True):
console.print(f" [cyan]{col}:[/cyan] {val.cast_primitive()}")
row_num += 1

Expand Down
3 changes: 3 additions & 0 deletions src/nebulagraph_python/value_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,9 @@ def __eq__(self, other):
return False
return self.value == other.value and self.data_type == other.data_type

def __hash__(self) -> int:
return hash((self.value, self.data_type))


class Row:
def __init__(self, values: Optional[List[ValueWrapper]] = None):
Expand Down