biocypher 0.6.0__py3-none-any.whl → 0.6.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of biocypher might be problematic. Click here for more details.
- biocypher/__init__.py +3 -2
- biocypher/_get.py +5 -6
- biocypher/_metadata.py +1 -1
- biocypher/output/write/_batch_writer.py +12 -2
- biocypher/output/write/graph/_neo4j.py +8 -1
- biocypher/output/write/graph/_rdf.py +7 -0
- biocypher/output/write/relational/_postgresql.py +7 -0
- {biocypher-0.6.0.dist-info → biocypher-0.6.2.dist-info}/METADATA +1 -1
- {biocypher-0.6.0.dist-info → biocypher-0.6.2.dist-info}/RECORD +11 -11
- {biocypher-0.6.0.dist-info → biocypher-0.6.2.dist-info}/LICENSE +0 -0
- {biocypher-0.6.0.dist-info → biocypher-0.6.2.dist-info}/WHEEL +0 -0
biocypher/__init__.py
CHANGED
|
@@ -21,10 +21,11 @@ __all__ = [
|
|
|
21
21
|
"log",
|
|
22
22
|
"Driver",
|
|
23
23
|
"BioCypher",
|
|
24
|
-
"
|
|
24
|
+
"FileDownload",
|
|
25
|
+
"APIRequest",
|
|
25
26
|
]
|
|
26
27
|
|
|
27
|
-
from ._get import
|
|
28
|
+
from ._get import APIRequest, FileDownload
|
|
28
29
|
from ._core import BioCypher
|
|
29
30
|
from ._config import config, module_data
|
|
30
31
|
from ._logger import log, logger, logfile
|
biocypher/_get.py
CHANGED
|
@@ -228,13 +228,12 @@ class Downloader:
|
|
|
228
228
|
paths = []
|
|
229
229
|
for url in file_download.url_s:
|
|
230
230
|
fname = url[url.rfind("/") + 1 :].split("?")[0]
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
path=os.path.join(self.cache_dir, file_download.name),
|
|
236
|
-
)
|
|
231
|
+
path = self._retrieve(
|
|
232
|
+
url=url,
|
|
233
|
+
fname=fname,
|
|
234
|
+
path=os.path.join(self.cache_dir, file_download.name),
|
|
237
235
|
)
|
|
236
|
+
paths.append(path)
|
|
238
237
|
else:
|
|
239
238
|
paths = []
|
|
240
239
|
fname = file_download.url_s[
|
biocypher/_metadata.py
CHANGED
|
@@ -18,6 +18,16 @@ from biocypher.output.write._writer import _Writer
|
|
|
18
18
|
class _BatchWriter(_Writer, ABC):
|
|
19
19
|
"""Abstract batch writer class"""
|
|
20
20
|
|
|
21
|
+
@abstractmethod
|
|
22
|
+
def _quote_string(self, value: str) -> str:
|
|
23
|
+
"""
|
|
24
|
+
Abstract method to quote a string. Escaping is handled by the database-specific writer.
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
raise NotImplementedError(
|
|
28
|
+
"Database writer must override '_quote_string'"
|
|
29
|
+
)
|
|
30
|
+
|
|
21
31
|
@abstractmethod
|
|
22
32
|
def _get_default_import_call_bin_prefix(self):
|
|
23
33
|
"""
|
|
@@ -626,7 +636,7 @@ class _BatchWriter(_Writer, ABC):
|
|
|
626
636
|
if isinstance(p, list):
|
|
627
637
|
plist.append(self._write_array_string(p))
|
|
628
638
|
else:
|
|
629
|
-
plist.append(
|
|
639
|
+
plist.append(self._quote_string(str(p)))
|
|
630
640
|
|
|
631
641
|
line.append(self.delim.join(plist))
|
|
632
642
|
line.append(labels)
|
|
@@ -861,7 +871,7 @@ class _BatchWriter(_Writer, ABC):
|
|
|
861
871
|
if isinstance(p, list):
|
|
862
872
|
plist.append(self._write_array_string(p))
|
|
863
873
|
else:
|
|
864
|
-
plist.append(self.
|
|
874
|
+
plist.append(self._quote_string(str(p)))
|
|
865
875
|
|
|
866
876
|
entries = [e.get_source_id()]
|
|
867
877
|
|
|
@@ -45,6 +45,13 @@ class _Neo4jBatchWriter(_BatchWriter):
|
|
|
45
45
|
|
|
46
46
|
return "bin/"
|
|
47
47
|
|
|
48
|
+
def _quote_string(self, value: str) -> str:
|
|
49
|
+
"""
|
|
50
|
+
Quote a string. Quote character is escaped by doubling it.
|
|
51
|
+
"""
|
|
52
|
+
|
|
53
|
+
return f"{self.quote}{value.replace(self.quote, self.quote * 2)}{self.quote}"
|
|
54
|
+
|
|
48
55
|
def _write_array_string(self, string_list):
|
|
49
56
|
"""
|
|
50
57
|
Abstract method to output.write the string representation of an array into a .csv file
|
|
@@ -57,7 +64,7 @@ class _Neo4jBatchWriter(_BatchWriter):
|
|
|
57
64
|
str: The string representation of an array for the neo4j admin import
|
|
58
65
|
"""
|
|
59
66
|
string = self.adelim.join(string_list)
|
|
60
|
-
return
|
|
67
|
+
return self._quote_string(string)
|
|
61
68
|
|
|
62
69
|
def _write_node_headers(self):
|
|
63
70
|
"""
|
|
@@ -391,6 +391,13 @@ class _RDFWriter(_BatchWriter):
|
|
|
391
391
|
"""
|
|
392
392
|
return ""
|
|
393
393
|
|
|
394
|
+
def _quote_string(self, value: str) -> str:
|
|
395
|
+
"""
|
|
396
|
+
Quote a string.
|
|
397
|
+
"""
|
|
398
|
+
|
|
399
|
+
return f"{self.quote}{value}{self.quote}"
|
|
400
|
+
|
|
394
401
|
def _write_array_string(self, string_list):
|
|
395
402
|
"""
|
|
396
403
|
Abstract method to write the string representation of an array into a .csv file
|
|
@@ -57,6 +57,13 @@ class _PostgreSQLBatchWriter(_BatchWriter):
|
|
|
57
57
|
)
|
|
58
58
|
return "VARCHAR"
|
|
59
59
|
|
|
60
|
+
def _quote_string(self, value: str) -> str:
|
|
61
|
+
"""
|
|
62
|
+
Quote a string.
|
|
63
|
+
"""
|
|
64
|
+
|
|
65
|
+
return f"{self.quote}{value}{self.quote}"
|
|
66
|
+
|
|
60
67
|
def _write_array_string(self, string_list) -> str:
|
|
61
68
|
"""
|
|
62
69
|
Abstract method to output.write the string representation of an array into a .csv file
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
biocypher/__init__.py,sha256
|
|
1
|
+
biocypher/__init__.py,sha256=-vr7dGUv6QK7f_i9mmUK5WpMsZuFPflUEFC4oElJTCA,980
|
|
2
2
|
biocypher/_config/__init__.py,sha256=fFHRFYxE2MtDAQWL6upe--MJ1vw3Z8CwIPhF2gW8cRU,3698
|
|
3
3
|
biocypher/_config/biocypher_config.yaml,sha256=pusj0IjJM3uWRcm0N7U7mb1IX257HCV2reZV3YKFCk0,3037
|
|
4
4
|
biocypher/_config/test_config.yaml,sha256=Np8jeS5_EP6HHOvMKb7B_Tkyqd5YaYlYz_DVsXypt-A,119
|
|
@@ -8,10 +8,10 @@ biocypher/_config/test_schema_config_extended.yaml,sha256=wn3A76142hhjnImhMF6ROD
|
|
|
8
8
|
biocypher/_core.py,sha256=m4o4Szv2xY2gl3PnNAA9m7Gg5Sgd8iR9THv3RDyZlQ8,22618
|
|
9
9
|
biocypher/_create.py,sha256=vpUchUdEpWupZi1LgFLxAWMtqoBwnWbP7PwEDUCBS4A,10202
|
|
10
10
|
biocypher/_deduplicate.py,sha256=BBvfpXzu6L5YDY5FdtXxnf8YlsbJpbCE8RdUoKsm0n0,4949
|
|
11
|
-
biocypher/_get.py,sha256=
|
|
11
|
+
biocypher/_get.py,sha256=1FHs4n2R2k7OVWtVe7euF2J5WpsUXsFAmnpdSYuhLvY,13817
|
|
12
12
|
biocypher/_logger.py,sha256=NGXe3hZA79WSujfOgpcxHBf8N2QAfrmvM1LFDpsGK2U,3185
|
|
13
13
|
biocypher/_mapping.py,sha256=ERSNH2Bg19145KytxbFE4BInPaiP-LWW7osOBot29Eo,9304
|
|
14
|
-
biocypher/_metadata.py,sha256=
|
|
14
|
+
biocypher/_metadata.py,sha256=D4HcHz3EKz_aLJ709LEcSnv5K3Nj4kX6DShGeA7j2Po,1657
|
|
15
15
|
biocypher/_misc.py,sha256=oKNfmj9mUKDYtmx-R6FCZxRa7AOut3VKZZm16KFimyY,6363
|
|
16
16
|
biocypher/_ontology.py,sha256=G5k-bnzvPZUqhLPxtoOPFa4OSQ4JpufgozVakLTjwLg,31789
|
|
17
17
|
biocypher/_translate.py,sha256=JafvhtVaFSpruRfYh9BzjVbvDF1Mhg7LLKMDZHWkRjg,16496
|
|
@@ -21,19 +21,19 @@ biocypher/output/connect/_neo4j_driver.py,sha256=jzF5sDhs_WnYEfXiSjQ1P3wNgoadl4C
|
|
|
21
21
|
biocypher/output/in_memory/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
22
22
|
biocypher/output/in_memory/_pandas.py,sha256=lsYQKjfxUy0O-ae4-YpsCJX-l85bxyc60WOj8gKfMfU,3080
|
|
23
23
|
biocypher/output/write/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
24
|
-
biocypher/output/write/_batch_writer.py,sha256=
|
|
24
|
+
biocypher/output/write/_batch_writer.py,sha256=Yev0Qpm6Tx2Z9Y89xAWPSy8rLuD1g3FbVKcG9R2D1yA,37239
|
|
25
25
|
biocypher/output/write/_get_writer.py,sha256=AeQcHQTrz68ZvtxsZl4W0ymc8cOxe3Qfq5PJRY7kq_I,3736
|
|
26
26
|
biocypher/output/write/_writer.py,sha256=v4-c8yME1UCJeqy8Lfmv7KtY7_B4QkWgADt5xkFNJFQ,7453
|
|
27
27
|
biocypher/output/write/graph/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
28
28
|
biocypher/output/write/graph/_arangodb.py,sha256=aUa_CNZyunFaPrJHc9RtVHRo0Fca9xJ-ZmRz4PxPO8c,8078
|
|
29
|
-
biocypher/output/write/graph/_neo4j.py,sha256=
|
|
29
|
+
biocypher/output/write/graph/_neo4j.py,sha256=rWCyxeajN3TCbE6W4L57c-CBrqtShVa8ufUkCjVZlGc,12067
|
|
30
30
|
biocypher/output/write/graph/_networkx.py,sha256=EW2we3FlqQ8KfLv4l_2wE27KBUlhXJyD5ORvowSjlaA,2545
|
|
31
|
-
biocypher/output/write/graph/_rdf.py,sha256=
|
|
31
|
+
biocypher/output/write/graph/_rdf.py,sha256=DdpStVXNEIdEvVHo23Qru63XY_IsUbfeAKjs9TPjHbo,18125
|
|
32
32
|
biocypher/output/write/relational/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
33
33
|
biocypher/output/write/relational/_csv.py,sha256=eyAtmwfCNYnuVbkpd0rUoo9KgG2KPgopZVA3X97tRLU,2919
|
|
34
|
-
biocypher/output/write/relational/_postgresql.py,sha256=
|
|
34
|
+
biocypher/output/write/relational/_postgresql.py,sha256=MRgDicNRW0KWene1nag4FgJ-nEUlpkulatG1S8D33s0,12107
|
|
35
35
|
biocypher/output/write/relational/_sqlite.py,sha256=ozElhca1YCYq8R-VFh-LDsnPBaXVJm2cvEboBK2LVVY,2073
|
|
36
|
-
biocypher-0.6.
|
|
37
|
-
biocypher-0.6.
|
|
38
|
-
biocypher-0.6.
|
|
39
|
-
biocypher-0.6.
|
|
36
|
+
biocypher-0.6.2.dist-info/LICENSE,sha256=SjUaQkq671iQUZOxEUpC4jvJxXOlfSiHTTueyz9kXJM,1065
|
|
37
|
+
biocypher-0.6.2.dist-info/METADATA,sha256=ZJfAl8_BsK1mRwFFy0HJOlkLKGiAByTeEdlwHX3C8Ec,10641
|
|
38
|
+
biocypher-0.6.2.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
|
|
39
|
+
biocypher-0.6.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|