Skip to content

Commit

Permalink
Merge pull request #3 from arthur-schnitzler/1-customize-list-views
Browse files Browse the repository at this point in the history
customize list views
  • Loading branch information
csae8092 authored Dec 8, 2023
2 parents 7a0d875 + c1720b8 commit f51cdfe
Show file tree
Hide file tree
Showing 201 changed files with 10,549 additions and 6,818 deletions.
4 changes: 3 additions & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ exclude =
manage.py
.git,
.tox,
env
env
venv
apis_core
8 changes: 4 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ jobs:
name: Lint
steps:
- name: Check out source repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up Python environment
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: "3.8"
python-version: "3.10"
- name: flake8 Lint
uses: py-actions/flake8@v1
uses: py-actions/flake8@v2
185 changes: 154 additions & 31 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,46 +1,169 @@

# Byte-compiled
# Byte-compiled / optimized / DLL files
__pycache__/
*.pyc
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# sqlite
/*.sqlite3
# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# test coverage
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
htmlcov/

# IDE
.idea
# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# migrations
vocabs/migrations/*
webpage/migrations/*
# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Ipython Notebook checkpoints
# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# Ipython Notebook
.ipynb
# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# envs
# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
server.py
s_wsgy.py
.env_dev
.secret
vocabseditor/settings/pg_local.py
.env_secret
media/uploads/*.rdf
media/uploads/*.ttl
requirements_dev.txt

*.ipynb
media/pmb-log.csv
media/professions.csv
hansi.csv
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/


json_dumps/
html/*.html
tei/
tmp/
pmb_dump.sql
apis_core/.DS_Store
.secret
play.ipynb
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
[![flake8 Lint](https://github.com/arthur-schnitzler/pmb-service/actions/workflows/lint.yml/badge.svg)](https://github.com/arthur-schnitzler/pmb-service/actions/workflows/lint.yml)
[![Build and publish Docker image](https://github.com/arthur-schnitzler/pmb-service/actions/workflows/build-deploy.yml/badge.svg)](https://github.com/arthur-schnitzler/pmb-service/actions/workflows/build-deploy.yml)
<!-- [![Build and publish Docker image](https://github.com/arthur-schnitzler/pmb-service/actions/workflows/build-deploy.yml/badge.svg)](https://github.com/arthur-schnitzler/pmb-service/actions/workflows/build-deploy.yml) -->

# PMB-SERVICE

lightweight APIS-PMB instance to generate TEI/XML dumps

maybe in future also with PMB CRUD included


## cheat-sheet

Expand Down
2 changes: 1 addition & 1 deletion apis_core/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.10.2'
__version__ = "0.10.2"
12 changes: 8 additions & 4 deletions apis_core/api_renderers.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ def render(self, data, media_type=None, renderer_context=None):
rel2 = re.match("^{}[a-z]*".format(r2), rel)
if rel2:
source = r
elif r.endswith('A'):
elif r.endswith("A"):
source = r
elif r.endswith('B'):
elif r.endswith("B"):
target = r
rel2 = re.match("^[a-z]*?{}$".format(r2), rel)
if rel2:
Expand All @@ -42,13 +42,17 @@ def render(self, data, media_type=None, renderer_context=None):
for k, v in d.items()
]
)
if d2["source"] is None or d2["target"] is None: #fix needed to not get 500s if relations without source or target exist in the data
if (
d2["source"] is None or d2["target"] is None
): # fix needed to not get 500s if relations without source or target exist in the data
continue
target_type = d2["target"]["url"].split("/")[-3].title()
source_type = d2["source"]["url"].split("/")[-3].title()
d2["target"]["type"] = target_type
d2["source"]["type"] = source_type
results2.append(d2)
data["results"] = results2
res3 = super().render(data, accepted_media_type=media_type, renderer_context=renderer_context)
res3 = super().render(
data, accepted_media_type=media_type, renderer_context=renderer_context
)
return res3
Loading

0 comments on commit f51cdfe

Please sign in to comment.