Skip to content

Commit

Permalink
Rename method map_identifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
cachitas committed Apr 1, 2024
1 parent db2ac87 commit 4a04ff4
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Firstly, it is recommended that you disambiguate your list of identifiers.
```python
identifiers = ["edin", "atta"]

disambiguated_identifiers = stringx.map_identifiers(identifiers, species=7227)
disambiguated_identifiers = stringx.map(identifiers, species=7227)
```

The `disambiguated_identifiers` JSON response can be manipulated and reused in follow-up calls. For instance:
Expand Down Expand Up @@ -54,6 +54,6 @@ Refer to the official [API documentation](https://string-db.org/help/api) for de

| Method | API URL | **stringx** |
| ----------------------------------- | ------------------------------- | ------------------------ |
| Mapping identifiers | /api/json/get_string_ids? | `map_identifiers()` |
| Mapping identifiers | /api/json/get_string_ids? | `map()` |
| Retrieving the interaction network | /api/tsv/network? | `network()` |
| Retrieving the interaction partners | /api/json/interaction_partners? | `interaction_partners()` |
4 changes: 2 additions & 2 deletions src/stringx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
DEFAULT_CALLER_IDENTITY = f"{__name__} {__version__}"


def map_identifiers(identifiers: List[str], species: int):
def map(identifiers: List[str], species: int):
with Client() as client:
return client.map_identifiers(identifiers=identifiers, species=species)
return client.map(identifiers=identifiers, species=species)


def network(identifiers: List[str], species: int):
Expand Down
2 changes: 1 addition & 1 deletion src/stringx/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def request(
response.raise_for_status()
return response.json()

def map_identifiers(
def map(
self,
identifiers: List[str],
species: int,
Expand Down
4 changes: 2 additions & 2 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def test_custom_caller_identity():
assert client.params["caller_identity"] == custom_identity


def test_map_identifiers(httpx_mock):
def test_map(httpx_mock):
httpx_mock.add_response(
url=httpx.URL(
"https://string-db.org/api/json/get_string_ids",
Expand All @@ -52,7 +52,7 @@ def test_map_identifiers(httpx_mock):
)

with stringx.Client() as client:
client.map_identifiers(["some_identifier"], 7227)
client.map(["some_identifier"], 7227)


def test_network(httpx_mock):
Expand Down
4 changes: 2 additions & 2 deletions tests/test_stringx.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import stringx


def test_map_identifiers():
identifiers = stringx.map_identifiers(["edin"], 7227)
def test_map():
identifiers = stringx.map(["edin"], 7227)

assert len(identifiers) == 1

Expand Down

0 comments on commit 4a04ff4

Please sign in to comment.