aboutsummaryrefslogtreecommitdiff
path: root/trygvis
diff options
context:
space:
mode:
Diffstat (limited to 'trygvis')
-rw-r--r--trygvis/eda/__main__.py2
-rw-r--r--trygvis/eda/cli/__init__.py7
-rwxr-xr-xtrygvis/eda/cli/db_stats.py2
-rw-r--r--trygvis/eda/cli/eda_rdf.py7
4 files changed, 11 insertions, 7 deletions
diff --git a/trygvis/eda/__main__.py b/trygvis/eda/__main__.py
index 5f641d8..66ee393 100644
--- a/trygvis/eda/__main__.py
+++ b/trygvis/eda/__main__.py
@@ -1,3 +1,3 @@
-from .cli import eda_rdf
+from trygvis.eda.cli import eda_rdf
eda_rdf.main()
diff --git a/trygvis/eda/cli/__init__.py b/trygvis/eda/cli/__init__.py
index 04de836..69905cd 100644
--- a/trygvis/eda/cli/__init__.py
+++ b/trygvis/eda/cli/__init__.py
@@ -45,12 +45,12 @@ def with_database(tx):
raise CliException("The database is corrupt: %s" % path)
elif db_type == 'sparql':
query_endpoint = config["db"]["url"]
- update_endpoint = config["db"]["update_url"]
- if update_endpoint is None:
+ if not hasattr(config["db"], "update_url") is None:
g = sparqlstore.SPARQLStore()
g.open(query_endpoint)
else:
+ update_endpoint = config["db"]["update_url"]
# def my_bnode_ext(node):
# if isinstance(node, BNode):
# return '<bnode:b%s>' % node
@@ -64,7 +64,8 @@ def with_database(tx):
try:
print("g=%s" % g)
tx(g)
- g.commit()
+ if isinstance(g, sparqlstore.SPARQLUpdateStore):
+ g.commit()
finally:
g.close()
diff --git a/trygvis/eda/cli/db_stats.py b/trygvis/eda/cli/db_stats.py
index 5261ed1..aabc46a 100755
--- a/trygvis/eda/cli/db_stats.py
+++ b/trygvis/eda/cli/db_stats.py
@@ -35,6 +35,6 @@ ORDER BY ?dk_part_number
""")
cli.info("Found %d Digi-Key parts:" % len(res))
for row in res:
- cli.info(" %-30s: %s" % (row.dk_part_number, row.label))
+ cli.info(" %-30s %s" % (row.dk_part_number, row.label))
cli.with_database(db_stats)
diff --git a/trygvis/eda/cli/eda_rdf.py b/trygvis/eda/cli/eda_rdf.py
index ecd4ba6..7b4ed2c 100644
--- a/trygvis/eda/cli/eda_rdf.py
+++ b/trygvis/eda/cli/eda_rdf.py
@@ -63,7 +63,8 @@ class DigikeyDownloadForSchematic(CliCommand):
class DigikeyDownloadMetadata(CliCommand):
def __init__(self):
- super().__init__("digikey-download-metadata", "Download category tree and attribute types and values from digikey.com")
+ super().__init__("digikey-download-metadata",
+ "Download category tree and attribute types and values from digikey.com")
def run(self, argv):
p = argparse.ArgumentParser(prog=self.key, description=self.description)
@@ -76,7 +77,8 @@ class DigikeyDownloadMetadata(CliCommand):
class DigikeyDownloadAttributeTypesForCategory(CliCommand):
def __init__(self):
- super().__init__("digikey-download-attribute-types-for-category", "Download the attribute types for a category from digikey.com")
+ super().__init__("digikey-download-attribute-types-for-category",
+ "Download the attribute types for a category from digikey.com")
def run(self, argv):
p = argparse.ArgumentParser(prog=self.key, description=self.description)
@@ -88,6 +90,7 @@ class DigikeyDownloadAttributeTypesForCategory(CliCommand):
from trygvis.eda.cli import digikey_download_attribute_types_for_category
digikey_download_attribute_types_for_category.run(args.category, args.sub_category, args.output, args)
+
class MakeBom(CliCommand):
def __init__(self):
super().__init__("make-bom", "Create a BOM for a project with all info for each part.")