Skip to content

Commit

Permalink
Merge branch 'main' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaume-gricourt committed Feb 23, 2023
2 parents d9267da + 1479ae8 commit ff89025
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 32 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## [0.9.0](https://github.com/brsynth/neo4jsbml/tree/0.9.0) (2023-01-27)

[Full Changelog](https://github.com/brsynth/neo4jsbml/compare/0.8.3...0.9.0)

**Merged pull requests:**

- chore\(deps\): bump actions/upload-artifact from 2 to 3 [\#4](https://github.com/brsynth/neo4jsbml/pull/4) ([dependabot[bot]](https://github.com/apps/dependabot))

## [0.8.3](https://github.com/brsynth/neo4jsbml/tree/0.8.3) (2023-01-16)

[Full Changelog](https://github.com/brsynth/neo4jsbml/compare/0.8.0...0.8.3)
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ python -m neo4jsbml \
--input-user-str "neo4j" \
--input-password-file <file> \
--input-database-str <str> \
--input-batch-int <int> \
# Config file
--input-config-file <file> \

Expand Down
7 changes: 0 additions & 7 deletions src/neo4jsbml/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,6 @@ def main():
default="neo4j",
help="The name of the database",
)
parser_dbb.add_argument(
"--input-batch-int",
default=connect.Connect.BATCH,
type=int,
help="The number of items to include in a batch",
)
parser_dbb_config = parser.add_argument_group(
"Database connection - Configuration file"
)
Expand Down Expand Up @@ -111,7 +105,6 @@ def main():
user=args.input_user_str,
database=args.input_database_str,
password_path=args.input_password_file,
batch=args.input_batch_int,
)
if con.is_connected() is False:
logging.error("Unable to connect to the database")
Expand Down
2 changes: 1 addition & 1 deletion src/neo4jsbml/_version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__app_name__ = "neo4jsbml"
__version__ = "0.9.0"
__version__ = "0.9.1"
11 changes: 0 additions & 11 deletions src/neo4jsbml/connect.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ class Connect(metaclass=singleton.Singleton):
the password to connect to the database
password_path: Optional[str]
the password provided by a file
batch: Optional[int] (default: 5000)
number of transactions before a commit for Neo4j
stats: Dict[str, int]
statistics dictionnary updated by create_nodes(), create_relationships
Keys: nodes, relationships
Expand All @@ -53,7 +51,6 @@ def from_config(cls, path: str) -> "Connect"
create a Connect from an .ini file
"""

BATCH = 5000
PROTOCOLS = ["neo4j", "bolt"]

def __init__(
Expand All @@ -65,7 +62,6 @@ def __init__(
port: int = 7687,
password: Optional[str] = None,
password_path: Optional[str] = None,
batch: Optional[int] = None,
) -> None:
self.protocol = protocol
self.url = url
Expand All @@ -83,9 +79,6 @@ def __init__(
)
else:
self.driver = neo4j.GraphDatabase.driver(self.uri)
self.batch = Connect.BATCH
if batch:
self.batch = int(batch)
self.stats: Dict[str, int] = {}

def is_connected(self) -> bool:
Expand Down Expand Up @@ -213,9 +206,5 @@ def from_config(cls, path: str) -> "Connect":
data["database"] = section.get("name")
if section.get("password"):
data["password"] = section.get("password")
if config.has_section("parameters"):
section = config["parameters"]
if section.get("batch"):
data["batch"] = section.get("batch")

return Connect(**data)
10 changes: 5 additions & 5 deletions src/neo4jsbml/sbml.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def find_by_label(

try:
cur_id = eval("from_obj.%s()" % (methods[0],))
except:
except Exception:
continue
if cur_id == to_id:
dbb_rel = srelationship.SRelationship(
Expand Down Expand Up @@ -213,7 +213,7 @@ def find_by_relationships(

try:
to_id = eval("from_obj.%s()" % (methods[0],))
except:
except Exception:
continue
if self.validate_id(value=to_id):
dbb_rel = srelationship.SRelationship(
Expand Down Expand Up @@ -246,7 +246,7 @@ def find_by_relationships(

try:
from_id = eval("to_obj.%s()" % (methods[0],))
except:
except Exception:
continue
if self.validate_id(value=from_id):
dbb_rel = srelationship.SRelationship(
Expand Down Expand Up @@ -500,8 +500,8 @@ def format_relationships(
% (from_label, to_label, arrow_rel.label)
)
if self.tag is not None:
for srel in res:
srel.add_property(label="tag", value=self.tag)
for srelation in res:
srelation.add_property(label="tag", value=self.tag)
return res

def validate_id(self, value: Any) -> bool:
Expand Down
3 changes: 0 additions & 3 deletions template/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,3 @@ port = 7687
user = neo4j
password = abc
name = neo4j

[parameters]
batch = 5000
3 changes: 0 additions & 3 deletions tests/dataset/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,3 @@ port = 7687
user = neo4j
password = abc
name = neo4j

[parameters]
batch = 5000
1 change: 0 additions & 1 deletion tests/test_connect.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,3 @@ def test_from_config(self, neo4j_config):
assert con_b.user == "neo4j"
assert con_b.database == "neo4j"
assert con_b.password == "test"
assert con_b.batch == 5000

0 comments on commit ff89025

Please sign in to comment.