Skip to content

Commit 199d5c5

Browse files
committed
Update configs and cleanup
1 parent bf577f6 commit 199d5c5

19 files changed

+1164
-306
lines changed

poetry.lock

Lines changed: 676 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,11 @@ types-python-dateutil = "^2.8.19.14"
5959
[build-system]
6060
requires = ["poetry-core>=1.0.0"]
6161
build-backend = "poetry.core.masonry.api"
62+
63+
[tool.ruff]
64+
line-length = 120
65+
66+
[tool.isort]
67+
profile = "black"
68+
multi_line_output = 3
69+
line_length = 120

src/rushdb/__init__.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,17 @@
55

66
from .client import RushDBClient
77
from .common import RushDBError
8-
from .models.relationship import RelationshipOptions, RelationshipDetachOptions
98
from .models.property import Property
109
from .models.record import Record
10+
from .models.relationship import RelationshipDetachOptions, RelationshipOptions
1111
from .models.transaction import Transaction
1212

13-
__all__ = ['RushDBClient', 'RushDBError', 'Record', 'Transaction', 'Property', 'RelationshipOptions', 'RelationshipDetachOptions']
13+
__all__ = [
14+
"RushDBClient",
15+
"RushDBError",
16+
"Record",
17+
"Transaction",
18+
"Property",
19+
"RelationshipOptions",
20+
"RelationshipDetachOptions",
21+
]

src/rushdb/api/base.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
if TYPE_CHECKING:
44
from ..client import RushDBClient
55

6+
67
class BaseAPI:
78
"""Base class for all API endpoints."""
8-
def __init__(self, client: 'RushDBClient'):
9+
10+
def __init__(self, client: "RushDBClient"):
911
self.client = client

src/rushdb/api/labels.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
11
from typing import List, Optional
22

3-
from .base import BaseAPI
43
from ..models.search_query import SearchQuery
54
from ..models.transaction import Transaction
5+
from .base import BaseAPI
66

77

88
class LabelsAPI(BaseAPI):
99
"""API for managing labels in RushDB."""
10-
def list(self, query: Optional[SearchQuery] = None, transaction: Optional[Transaction] = None) -> List[str]:
10+
11+
def list(
12+
self,
13+
query: Optional[SearchQuery] = None,
14+
transaction: Optional[Transaction] = None,
15+
) -> List[str]:
1116
"""List all labels."""
12-
headers = Transaction._build_transaction_header(transaction.id if transaction else None)
17+
headers = Transaction._build_transaction_header(
18+
transaction.id if transaction else None
19+
)
1320

14-
return self.client._make_request('POST', '/api/v1/labels', data=query or {}, headers=headers)
21+
return self.client._make_request(
22+
"POST", "/api/v1/labels", data=query or {}, headers=headers
23+
)

src/rushdb/api/properties.py

Lines changed: 49 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,68 @@
1-
from typing import List, Optional, Literal
1+
from typing import List, Literal, Optional
22

3-
from .base import BaseAPI
43
from ..models.property import Property, PropertyValuesData
54
from ..models.search_query import SearchQuery
65
from ..models.transaction import Transaction
6+
from .base import BaseAPI
77

88

99
class PropertiesAPI(BaseAPI):
1010
"""API for managing properties in RushDB."""
11-
def find(self, query: Optional[SearchQuery] = None, transaction: Optional[Transaction] = None) -> List[Property]:
11+
12+
def find(
13+
self,
14+
query: Optional[SearchQuery] = None,
15+
transaction: Optional[Transaction] = None,
16+
) -> List[Property]:
1217
"""List all properties."""
13-
headers = Transaction._build_transaction_header(transaction.id if transaction else None)
18+
headers = Transaction._build_transaction_header(
19+
transaction.id if transaction else None
20+
)
1421

15-
return self.client._make_request('POST', '/api/v1/properties', query or {}, headers)
22+
return self.client._make_request(
23+
"POST", "/api/v1/properties", query or {}, headers
24+
)
1625

17-
def find_by_id(self, property_id: str, transaction: Optional[Transaction] = None) -> Property:
26+
def find_by_id(
27+
self, property_id: str, transaction: Optional[Transaction] = None
28+
) -> Property:
1829
"""Get a property by ID."""
19-
headers = Transaction._build_transaction_header(transaction.id if transaction else None)
30+
headers = Transaction._build_transaction_header(
31+
transaction.id if transaction else None
32+
)
2033

21-
return self.client._make_request('GET', f'/api/v1/properties/{property_id}', headers=headers)
34+
return self.client._make_request(
35+
"GET", f"/api/v1/properties/{property_id}", headers=headers
36+
)
2237

23-
def delete(self, property_id: str, transaction: Optional[Transaction] = None) -> None:
38+
def delete(
39+
self, property_id: str, transaction: Optional[Transaction] = None
40+
) -> None:
2441
"""Delete a property."""
25-
headers = Transaction._build_transaction_header(transaction.id if transaction else None)
42+
headers = Transaction._build_transaction_header(
43+
transaction.id if transaction else None
44+
)
2645

27-
return self.client._make_request('DELETE', f'/api/v1/properties/{property_id}', headers=headers)
46+
return self.client._make_request(
47+
"DELETE", f"/api/v1/properties/{property_id}", headers=headers
48+
)
2849

29-
def values(self, property_id: str, sort: Optional[Literal['asc', 'desc']], skip: Optional[int], limit: Optional[int], transaction: Optional[Transaction] = None) -> PropertyValuesData:
50+
def values(
51+
self,
52+
property_id: str,
53+
sort: Optional[Literal["asc", "desc"]],
54+
skip: Optional[int],
55+
limit: Optional[int],
56+
transaction: Optional[Transaction] = None,
57+
) -> PropertyValuesData:
3058
"""Get values data for a property."""
31-
headers = Transaction._build_transaction_header(transaction.id if transaction else None)
59+
headers = Transaction._build_transaction_header(
60+
transaction.id if transaction else None
61+
)
3262

33-
return self.client._make_request('GET', f'/api/v1/properties/{property_id}/values', headers=headers, params={ "sort": sort, "skip": skip, "limit": limit })
63+
return self.client._make_request(
64+
"GET",
65+
f"/api/v1/properties/{property_id}/values",
66+
headers=headers,
67+
params={"sort": sort, "skip": skip, "limit": limit},
68+
)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy