Skip to content

Commit

Permalink
Merge 4c727fe into 90629aa
Browse files Browse the repository at this point in the history
  • Loading branch information
PonteIneptique committed Feb 18, 2021
2 parents 90629aa + 4c727fe commit 4373660
Show file tree
Hide file tree
Showing 26 changed files with 75 additions and 963 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/test.yml
@@ -0,0 +1,46 @@
name: Test library

on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install nose coveralls
python setup.py develop
pip install -r test-requirements.txt
# - name: Lint with flake8
# run: |
# # stop the build if there are Python syntax errors or undefined names
# flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with nose
run: |
nosetests --with-coverage --cover-package=capitains_nautilus --verbose --nologcapture --with-doctest ./tests
- name: Coveralls Parallel
uses: AndreMiras/coveralls-python-action@develop
if: runner.os == 'Linux'
with:
flag-name: run-${{ matrix.test_number }}
parallel: true
coveralls_finish:
needs: test
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: AndreMiras/coveralls-python-action@develop
with:
parallel-finished: true
2 changes: 1 addition & 1 deletion capitains_nautilus/cmd.py
Expand Up @@ -2,7 +2,7 @@

from capitains_nautilus.flask_ext import FlaskNautilus
from capitains_nautilus.cts.resolver.base import NautilusCtsResolver
from werkzeug.contrib.cache import FileSystemCache, RedisCache, NullCache
from cachelib import FileSystemCache, RedisCache, NullCache
from flask import Flask
import argparse
import logging
Expand Down
43 changes: 0 additions & 43 deletions capitains_nautilus/collections/sparql.py
Expand Up @@ -3,7 +3,6 @@
from MyCapytain.resources.prototypes.metadata import Collection
from rdflib import Literal, RDFS, RDF, URIRef, Graph, plugin
from rdflib.store import Store
from rdflib_sqlalchemy import registerplugins
from rdflib.namespace import SKOS
from warnings import warn

Expand All @@ -25,48 +24,6 @@ def clear_graph(identifier=None):
warn("Unable to close the Graph")


def generate_alchemy_graph(alchemy_uri, prefixes=None, identifier="NautilusSparql"):
""" Generate a graph and change the global graph to this one
:param alchemy_uri: A Uri for the graph
:param prefixes: A dictionary of prefixes and namespaces to bind to the graph
:param identifier: An identifier that will identify the Graph root
"""
registerplugins()
ident = URIRef(identifier)
uri = Literal(alchemy_uri)
store = plugin.get("SQLAlchemy", Store)(identifier=ident)
graph = Graph(store, identifier=ident)
graph.open(uri, create=True)

for prefix, ns in (prefixes or GRAPH_BINDINGS).items():
if prefix == "":
prefix = "cts" # Fix until ALchemy Store accepts empty prefixes
graph.bind(prefix, ns)

return graph, identifier, uri


def generate_sleepy_cat_graph(filepath, prefixes=None, identifier="NautilusSparql"):
""" Generate a graph and change the global graph to this one
:param filepath: A Uri for the graph
:param prefixes: A dictionary of prefixes and namespaces to bind to the graph
:param identifier: An identifier that will identify the Graph root
"""
registerplugins()
ident = URIRef(identifier)
graph = Graph('Sleepycat', identifier=ident)
graph.open(filepath, create=True)

for prefix, ns in (prefixes or GRAPH_BINDINGS).items():
if prefix == "":
prefix = "cts" # Fix until ALchemy Store accepts empty prefixes
graph.bind(prefix, ns)

return graph, identifier, filepath


def NoneGenerator(object_id):
return None

Expand Down

0 comments on commit 4373660

Please sign in to comment.