Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/bpp/admin/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
from django.contrib.contenttypes.models import ContentType
from django.db.models import Count, F, IntegerField, Max, Q
from django.db.models.functions import Cast
from pbn_client.const import ACTIVE, DELETED

from bpp.models import BppUser, Uczelnia, Wydawnictwo_Zwarte
from bpp.models.struktura import Jednostka
from pbn_api.const import ACTIVE, DELETED


class SimpleIntegerFilter(SimpleListFilter):
Expand Down
6 changes: 6 additions & 0 deletions src/bpp/newsfragments/pbn-slim-shims.doc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Usunięto trzy zbędne shimy zgodności (``pbn_api.const``, ``pbn_api.utils``,
``pbn_api.client.transport``) — czyste re-eksporty z pakietów PBN. Kod importuje
teraz stałe, helpery słownikowe i transport wprost z ``pbn_client`` (spójnie z
resztą kodu po ekstrakcji). Warstwa zgodności ``pbn_api.exceptions`` oraz baza
modeli ``pbn_api.models.base`` pozostają (mają zawartość BPP-specific / stanowią
punkt rozszerzeń).
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import pytest
from model_bakery import baker
from pbn_client.const import PBN_GET_JOURNAL_BY_ID

from bpp.const import PBN_UID_LEN
from bpp.models.konferencja import Konferencja
Expand All @@ -29,7 +30,6 @@
pbn_publisher_json,
)
from pbn_api.client import PBN_GET_PUBLICATION_BY_ID_URL, PBN_SEARCH_PUBLICATIONS_URL
from pbn_api.const import PBN_GET_JOURNAL_BY_ID
from pbn_api.models import Journal, Publication, Publisher


Expand Down
2 changes: 1 addition & 1 deletion src/importer_publikacji/providers/pbn.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ def _get_pbn_client(uczelnia):
"""
from django.conf import settings
from pbn_client.conf import settings as pbn_defaults
from pbn_client.transport import RequestsTransport

from pbn_api.client import PBNClient
from pbn_api.client.transport import RequestsTransport
from pbn_api.reporting import rollbar_reporter

if not uczelnia or not all(
Expand Down
10 changes: 5 additions & 5 deletions src/pbn_api/client/publication_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,16 @@
from django.core.mail import mail_admins
from django.db import transaction
from django.db.models import Model
from pbn_client.const import (
PBN_POST_PUBLICATION_NO_STATEMENTS_URL,
PBN_POST_PUBLICATIONS_URL,
)
from pbn_client.statements import StatementsMixin

from pbn_api.adapters.wydawnictwo import (
OplataZaWydawnictwoPBNAdapter,
WydawnictwoPBNAdapter,
)
from pbn_api.const import (
PBN_POST_PUBLICATION_NO_STATEMENTS_URL,
PBN_POST_PUBLICATIONS_URL,
)
from pbn_api.exceptions import (
CannotDeleteStatementsException,
CannotUploadPublicationFee,
Expand All @@ -35,7 +36,6 @@
)
from pbn_api.models.pbn_odpowiedzi_niepozadane import PBNOdpowiedziNiepozadane
from pbn_api.models.sentdata import SentData
from pbn_client.statements import StatementsMixin

logger = logging.getLogger(__name__)

Expand Down
6 changes: 0 additions & 6 deletions src/pbn_api/client/transport.py

This file was deleted.

6 changes: 0 additions & 6 deletions src/pbn_api/const.py

This file was deleted.

10 changes: 5 additions & 5 deletions src/pbn_api/management/commands/pbn_test_wysylka_interaktywna.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@

from django.core.management.base import CommandError
from pbn_client import decode_publication_object_id

from bpp.models import Wydawnictwo_Ciagle, Wydawnictwo_Zwarte
from bpp.util import zaloguj_polkniety_wyjatek
from pbn_api.adapters.wydawnictwo import WydawnictwoPBNAdapter
from pbn_api.const import (
from pbn_client.const import (
PBN_DELETE_PUBLICATION_STATEMENT,
PBN_GET_INSTITUTION_STATEMENTS,
PBN_POST_INSTITUTION_STATEMENTS_URL,
PBN_POST_PUBLICATION_NO_STATEMENTS_URL,
PBN_POST_PUBLICATIONS_URL,
)

from bpp.models import Wydawnictwo_Ciagle, Wydawnictwo_Zwarte
from bpp.util import zaloguj_polkniety_wyjatek
from pbn_api.adapters.wydawnictwo import WydawnictwoPBNAdapter
from pbn_api.exceptions import (
AccessDeniedException,
DaneLokalneWymagajaAktualizacjiException,
Expand Down
2 changes: 1 addition & 1 deletion src/pbn_api/models/sentdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
from django.db import models
from django.db.models import JSONField
from django.utils import timezone
from pbn_client.dict_utils import compare_dicts

from bpp import const
from bpp.models import LinkDoPBNMixin
from pbn_api.utils import compare_dicts


class SentDataManager(models.Manager):
Expand Down
12 changes: 6 additions & 6 deletions src/pbn_api/tests/test_bpp_admin_helpers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import pytest
from django.contrib.messages import get_messages
from model_bakery import baker
from pbn_client.const import (
PBN_GET_INSTITUTION_PUBLICATIONS_V2,
PBN_POST_INSTITUTION_STATEMENTS_URL,
PBN_POST_PUBLICATION_NO_STATEMENTS_URL,
PBN_POST_PUBLICATIONS_URL,
)

from bpp.admin.helpers.pbn_api.gui import sprobuj_wyslac_do_pbn_gui
from bpp.models import Charakter_Formalny, Wydawnictwo_Ciagle
Expand All @@ -15,12 +21,6 @@
PBN_GET_INSTITUTION_STATEMENTS,
PBN_GET_PUBLICATION_BY_ID_URL,
)
from pbn_api.const import (
PBN_GET_INSTITUTION_PUBLICATIONS_V2,
PBN_POST_INSTITUTION_STATEMENTS_URL,
PBN_POST_PUBLICATION_NO_STATEMENTS_URL,
PBN_POST_PUBLICATIONS_URL,
)
from pbn_api.exceptions import AccessDeniedException, PBNValidationError
from pbn_api.models import Publication, SentData
from pbn_api.tests.utils import middleware
Expand Down
2 changes: 1 addition & 1 deletion src/pbn_api/tests/test_client_disciplines.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
from pathlib import Path

import pytest
from pbn_client.const import PBN_GET_DISCIPLINES_URL

from bpp.decorators import json
from bpp.models import Dyscyplina_Naukowa
from pbn_api.const import PBN_GET_DISCIPLINES_URL
from pbn_api.models import TlumaczDyscyplin
from pbn_api.models.discipline import Discipline

Expand Down
2 changes: 1 addition & 1 deletion src/pbn_api/tests/test_client_extended.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def test_pbn_client_transport_initialization():

def test_pbn_client_transport_default_base_url():
"""Test PBNClientTransport uses default URL when None provided"""
from pbn_api.const import DEFAULT_BASE_URL
from pbn_client.const import DEFAULT_BASE_URL

transport = PBNClientTransport("app_id", "app_token", None)

Expand Down
10 changes: 5 additions & 5 deletions src/pbn_api/tests/test_client_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
import pytest
from django.contrib.messages import get_messages
from model_bakery import baker
from pbn_client.const import (
PBN_GET_INSTITUTION_PUBLICATIONS_V2,
PBN_POST_INSTITUTION_STATEMENTS_URL,
PBN_POST_PUBLICATION_NO_STATEMENTS_URL,
)

from bpp.admin.helpers.pbn_api.gui import sprobuj_wyslac_do_pbn_gui
from fixtures.pbn_api import (
Expand All @@ -21,11 +26,6 @@
PBN_GET_INSTITUTION_STATEMENTS,
PBN_GET_PUBLICATION_BY_ID_URL,
)
from pbn_api.const import (
PBN_GET_INSTITUTION_PUBLICATIONS_V2,
PBN_POST_INSTITUTION_STATEMENTS_URL,
PBN_POST_PUBLICATION_NO_STATEMENTS_URL,
)
from pbn_api.models import Institution, Publication
from pbn_api.tests.utils import middleware

Expand Down
14 changes: 7 additions & 7 deletions src/pbn_api/tests/test_client_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@
from unittest.mock import MagicMock, patch

import pytest
from pbn_client.const import (
PBN_GET_INSTITUTION_PUBLICATIONS_V2,
PBN_POST_INSTITUTION_STATEMENTS_URL,
PBN_POST_PUBLICATION_NO_STATEMENTS_URL,
PBN_POST_PUBLICATIONS_URL,
)
from pbn_client.exceptions import PBNValidationError

from fixtures.pbn_api import (
MOCK_RETURNED_INSTITUTION_PUBLICATION_V2_DATA,
Expand All @@ -36,19 +43,12 @@
PBN_GET_INSTITUTION_STATEMENTS,
PBN_GET_PUBLICATION_BY_ID_URL,
)
from pbn_api.const import (
PBN_GET_INSTITUTION_PUBLICATIONS_V2,
PBN_POST_INSTITUTION_STATEMENTS_URL,
PBN_POST_PUBLICATION_NO_STATEMENTS_URL,
PBN_POST_PUBLICATIONS_URL,
)
from pbn_api.exceptions import (
HttpException,
PKZeroExportDisabled,
StatementsResendFailedException,
)
from pbn_api.models import Publication, SentData
from pbn_client.exceptions import PBNValidationError


def _patch_intended_statements(monkeypatch, statements):
Expand Down
21 changes: 11 additions & 10 deletions src/pbn_api/tests/test_client_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@

import pytest
from model_bakery import baker
from pbn_client.const import (
PBN_POST_PUBLICATION_NO_STATEMENTS_URL,
PBN_POST_PUBLICATIONS_URL,
)

from pbn_api.adapters.wydawnictwo import WydawnictwoPBNAdapter
from pbn_api.client import (
PBN_DELETE_PUBLICATION_STATEMENT,
PBN_GET_INSTITUTION_STATEMENTS,
)
from pbn_api.const import (
PBN_POST_PUBLICATION_NO_STATEMENTS_URL,
PBN_POST_PUBLICATIONS_URL,
)
from pbn_api.exceptions import SameDataUploadedRecently, StatementsMissing
from pbn_api.models import Publication, SentData

Expand Down Expand Up @@ -123,9 +123,9 @@ def test_PBNClient_test_upload_publication_bez_statements_idzie_do_repo(

# Body wysłane do /v1/repositorium/publications: lista, BEZ statements,
# po konwersji pól (givenNames → firstName).
sent_body = pbn_client.transport.input_values[PBN_POST_PUBLICATION_NO_STATEMENTS_URL][
"body"
]
sent_body = pbn_client.transport.input_values[
PBN_POST_PUBLICATION_NO_STATEMENTS_URL
]["body"]
assert isinstance(sent_body, list) and len(sent_body) == 1
assert "statements" not in sent_body[0]
assert "firstName" in sent_body[0]["authors"][0]
Expand Down Expand Up @@ -162,13 +162,14 @@ def test_PBNClient_post_publication_no_statements(
Uczelnia z ``pbn_wysylaj_bez_oswiadczen=True`` pozwala na wysyłkę prac
bez oświadczeń (inaczej adapter rzuca StatementsMissing w pbn_get_json).
"""
from fixtures.pbn_api import MOCK_RETURNED_MONGODB_DATA
from pbn_api.client import PBN_GET_PUBLICATION_BY_ID_URL
from pbn_api.const import (
from pbn_client.const import (
PBN_GET_INSTITUTION_PUBLICATIONS_V2,
PBN_GET_INSTITUTION_STATEMENTS,
)

from fixtures.pbn_api import MOCK_RETURNED_MONGODB_DATA
from pbn_api.client import PBN_GET_PUBLICATION_BY_ID_URL

uczelnia.pbn_wysylaj_bez_oswiadczen = True
uczelnia.save()

Expand Down
6 changes: 3 additions & 3 deletions src/pbn_api/tests/test_pbn_test_wysylka_interaktywna.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
import pytest
from django.core.management import call_command
from django.core.management.base import CommandError

from fixtures.pbn_api import pbn_pageable_json
from pbn_api.const import (
from pbn_client.const import (
PBN_DELETE_PUBLICATION_STATEMENT,
PBN_GET_INSTITUTION_STATEMENTS,
PBN_POST_INSTITUTION_STATEMENTS_URL,
PBN_POST_PUBLICATION_NO_STATEMENTS_URL,
PBN_POST_PUBLICATIONS_URL,
)

from fixtures.pbn_api import pbn_pageable_json
from pbn_api.exceptions import HttpException
from pbn_api.management.commands import pbn_test_wysylka_interaktywna as cmd_mod

Expand Down
2 changes: 1 addition & 1 deletion src/pbn_api/tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from pbn_api.utils import rename_dict_key
from pbn_client.dict_utils import rename_dict_key


def test_rename_dict_key_simple():
Expand Down
6 changes: 0 additions & 6 deletions src/pbn_api/utils.py

This file was deleted.

3 changes: 2 additions & 1 deletion src/pbn_export_queue/views/detail_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,9 @@ def _resolve_api_endpoint(self, sent_data):
if sent_data.api_url:
return sent_data.api_url

from pbn_client.const import PBN_POST_PUBLICATION_NO_STATEMENTS_URL

from bpp.models import Uczelnia
from pbn_api.const import PBN_POST_PUBLICATION_NO_STATEMENTS_URL

uczelnia = Uczelnia.objects.get_for_request(self.request)
if uczelnia and uczelnia.pbn_api_root:
Expand Down
2 changes: 1 addition & 1 deletion src/pbn_integrator/importer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

import logging

from pbn_client.const import DELETED
from tqdm import tqdm

from bpp.models import Dyscyplina_Naukowa, Jednostka, Rekord, Rodzaj_Zrodla
from pbn_api.client import PBNClient
from pbn_api.const import DELETED
from pbn_api.models import Publication

# Re-export publication import functions
Expand Down
2 changes: 1 addition & 1 deletion src/pbn_integrator/importer/publishers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

from django.core.management import call_command
from django.db import transaction
from pbn_client.const import DELETED

from bpp import const
from bpp.models import Wydawca
from bpp.models.wydawca import Poziom_Wydawcy
from pbn_api.const import DELETED
from pbn_api.models import Publisher
from pbn_integrator.utils import zapisz_mongodb

Expand Down
3 changes: 2 additions & 1 deletion src/pbn_integrator/utils/institutions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@

from typing import TYPE_CHECKING

from pbn_client.const import ACTIVE, DELETED

from bpp.models import Jednostka, Uczelnia
from pbn_api.const import ACTIVE, DELETED
from pbn_api.models import Institution
from pbn_integrator.utils.mongodb_ops import pobierz_mongodb, zapisz_mongodb
from pbn_integrator.utils.threaded_page_getter import (
Expand Down
2 changes: 1 addition & 1 deletion src/pbn_integrator/utils/journals.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
from typing import TYPE_CHECKING

from django.db.models import F, Func, IntegerField, Q
from pbn_client.const import ACTIVE, DELETED

from bpp.models import Zrodlo
from bpp.util import pbar
from pbn_api.const import ACTIVE, DELETED
from pbn_api.models import Journal
from pbn_integrator.utils.threaded_page_getter import (
ThreadedMongoDBSaver,
Expand Down
3 changes: 2 additions & 1 deletion src/pbn_integrator/utils/odswiez_tabele_publikacji.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from pbn_api.const import DELETED
from pbn_client.const import DELETED

from pbn_api.exceptions import BrakIDPracyPoStroniePBN


Expand Down
2 changes: 1 addition & 1 deletion src/pbn_integrator/utils/offline_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
from typing import TYPE_CHECKING

from django.db import transaction
from pbn_client.const import ACTIVE, DELETED

from bpp.util import pbar
from pbn_api.const import ACTIVE, DELETED
from pbn_api.models import Publication, Scientist
from pbn_integrator.utils.mongodb_ops import pobierz_mongodb
from pbn_integrator.utils.multiprocessing_utils import (
Expand Down
2 changes: 1 addition & 1 deletion src/pbn_integrator/utils/pobierz_skasowane_prace.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def pobierz_skasowane_prace(client):

from multiprocessing import Pool

from pbn_api.const import DELETED
from pbn_client.const import DELETED

from bpp.util import pbar

Expand Down
Loading
Loading