Skip to content

Commit

Permalink
applied formating
Browse files Browse the repository at this point in the history
  • Loading branch information
tholzheim committed Jul 16, 2024
1 parent ba42904 commit 787dceb
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 33 deletions.
15 changes: 2 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,6 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
pip install ruff
- name: start neo4j
run: |
scripts/neo4j
Expand All @@ -47,16 +41,11 @@ jobs:
# pip install sphinx_rtd_theme
# scripts/doc

- name: Prepare cache directory
run: |
sudo mkdir -p ~/.ceurws
sudo chmod 755 ~/.ceurws
- name: Cache Sqlite
id: cache-sqlite
uses: actions/cache@v4
with:
path: ~/.ceurws
path: $GITHUB_WORKSPACE/.ceurws
key: ceurws

- name: fill sqlite
Expand All @@ -67,7 +56,7 @@ jobs:
id: saveSqlite
uses: actions/cache/save@v4
with:
path: ~/.ceurws
path: $GITHUB_WORKSPACE/.ceurws
key: ceurws

- name: Run tests
Expand Down
2 changes: 1 addition & 1 deletion ceurws/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def createExternalLink(
str - html link for external id
"""
value = self.getRowValue(row, key)
if not value or value==View.noneValue:
if not value or value == View.noneValue:
if emptyIfNone:
return ""
else:
Expand Down
16 changes: 7 additions & 9 deletions ceurws/volume_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from ngwidgets.lod_grid import GridConfig, ListOfDictsGrid
from ngwidgets.progress import NiceguiProgressbar
from ngwidgets.widgets import Link
from nicegui import ui, run
from nicegui import run, ui

from ceurws.ceur_ws import Volume
from ceurws.view import View
Expand Down Expand Up @@ -275,8 +275,8 @@ def add_msg(self, html_markup: str):
"""
with self.log_row:
self.log_view.content += html_markup
def updateWikidataVolumes(self,selected_rows):

def updateWikidataVolumes(self, selected_rows):
"""
update wikidata volumes for the selected rows
"""
Expand All @@ -287,7 +287,7 @@ def updateWikidataVolumes(self,selected_rows):
sorted_rows = sorted(selected_rows, key=lambda row: row["#"])
for row in sorted_rows:
vol_number = row["#"]
volume = self.wdSync.volumesByNumber[vol_number]
volume = self.wdSync.volumesByNumber[vol_number]
self.add_or_update_volume_in_wikidata(volume)
pass
except Exception as ex:
Expand All @@ -298,9 +298,8 @@ async def onWikidataButtonClick(self, _args):
handle wikidata sync request
"""
selected_rows = await self.lod_grid.get_selected_rows()
await run.io_bound(self.updateWikidataVolumes,selected_rows)


await run.io_bound(self.updateWikidataVolumes, selected_rows)

def check_recently_updated_volumes(self):
"""
check recently updated volumes
Expand Down Expand Up @@ -339,7 +338,6 @@ async def on_check_recently_update_volumes_button_click(self, args):
handle clicking of the refresh button to get recently added volumes
"""
await run.io_bound(self.check_recently_updated_volumes)


def updateRecentlyAddedVolume(self, volume, index, total):
"""
Expand Down Expand Up @@ -381,7 +379,7 @@ def get_volume_lod(self):
def add_or_update_volume_in_wikidata(self, volume: Volume):
"""
add the given volume to wikidata or update it if it already exists
Args:
volume(Volume): the CEUR-WS volume to update proceedings and event entries for
"""
Expand Down
15 changes: 6 additions & 9 deletions ceurws/wikidata_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"""

from ngwidgets.lod_grid import ListOfDictsGrid
from nicegui import ui,run
from nicegui import run, ui
from wd.query_view import QueryView

from ceurws.view import View
Expand Down Expand Up @@ -72,10 +72,7 @@ def reload_aggrid(self, olod: list):
eventSeriesLink = self.createItemLink(row, "eventSeries", separator="|")
dblpLink = self.createExternalLink(row, "dblpProceedingsId", "dblp", DblpEndpoint.DBLP_REC_PREFIX)
k10PlusLink = self.createExternalLink(
row,
"ppnId",
"k10plus",
"https://opac.k10plus.de/DB=2.299/PPNSET?PPN="
row, "ppnId", "k10plus", "https://opac.k10plus.de/DB=2.299/PPNSET?PPN="
)
lod.append(
{
Expand All @@ -93,16 +90,16 @@ def reload_aggrid(self, olod: list):
)
self.lod_grid.load_lod(lod)
# set max width of Item column
self.lod_grid.set_column_def("item","maxWidth",380)
self.lod_grid.set_column_def("event","maxWidth",380)
self.lod_grid.set_column_def("item", "maxWidth", 380)
self.lod_grid.set_column_def("event", "maxWidth", 380)
self.lod_grid.sizeColumnsToFit()

async def on_refresh_button_click(self):
"""
handle the refreshing of the proceedings from wikidata
"""
await run.io_bound(self.refresh_wikidata)

def refresh_wikidata(self):
try:
with self.solution.container:
Expand Down
2 changes: 1 addition & 1 deletion ceurws/wikidatasync.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def __init__(
self.wdQuery = self.qm.queriesByName["Proceedings"]
self.baseurl = baseurl
self.wd = Wikidata(debug=debug)
self.sqldb = SQLDB(CEURWS.CACHE_FILE,check_same_thread=False)
self.sqldb = SQLDB(CEURWS.CACHE_FILE, check_same_thread=False)
self.procRecords = None
self.procsByVolnumber = None
self.dblpEndpoint = DblpEndpoint(endpoint=dblp_endpoint_url)
Expand Down

0 comments on commit 787dceb

Please sign in to comment.