Skip to content

Commit

Permalink
chore: remove unused files and classes, move test to test directory
Browse files Browse the repository at this point in the history
  • Loading branch information
b1rger committed May 27, 2024
1 parent 5ff57cd commit 8124531
Show file tree
Hide file tree
Showing 9 changed files with 1 addition and 307 deletions.
7 changes: 0 additions & 7 deletions apis_core/apis_entities/api_renderers.py

This file was deleted.

56 changes: 0 additions & 56 deletions apis_core/apis_entities/autocomplete3.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,62 +14,6 @@
from apis_core.utils.settings import get_entity_settings_by_modelname


class CustomEntityAutocompletes(object):
"""A class for collecting all the custom autocomplete functions for one entity.
Attributes:
- self.entity: (string) entity types
- self.more: (boolean) if more results can be fetched (pagination)
- self.page_size: (integer) page size
- self.results: (list) results
- self.query: (string) query string
Methods:
- self.more(): fetch more results
"""

def __init__(self, entity, query, page_size=20, offset=0, *args, **kwargs):
"""
:param entity: (string) entity type to fetch additional autocompletes for
"""
func_list = {}
if entity not in func_list.keys():
self.results = None
return None
res = []
more = dict()
more_gen = False
for x in func_list[entity]:
res2 = x().query(query, page_size, offset)
if len(res2) == page_size:
more[x.__name__] = (True, offset + 1)
more_gen = True
res.extend(res2)
self.results = res
self.page_size = page_size
self.more = more_gen
self._more_dict = more
self.query = query
self.offset = offset

def get_more(self):
"""
Function to retrieve more results.
"""
res4 = []
for key, value in self._more_dict.items():
if value[0]:
res3 = globals()[key](self.query, self.page_size, value[1])
if len(res3) == self.page_size:
self._more_dict[key] = (True, value[1] + 1)
else:
self._more_dict[key] = (False, value[1])
self.results.extend(res3)
res4.extend(res3)
return res4


# TODO RDF: Check if this should be removed or adapted
class GenericNetworkEntitiesAutocomplete(autocomplete.Select2ListView):
def get(self, request, *args, **kwargs):
Expand Down
15 changes: 0 additions & 15 deletions apis_core/apis_entities/test_api.py

This file was deleted.

26 changes: 0 additions & 26 deletions apis_core/apis_entities/test_models.py

This file was deleted.

1 change: 0 additions & 1 deletion apis_core/apis_entities/tests.py

This file was deleted.

25 changes: 0 additions & 25 deletions apis_core/apis_metainfo/api_renderers.py

This file was deleted.

31 changes: 1 addition & 30 deletions apis_core/apis_metainfo/serializers.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,10 @@
from django.contrib.contenttypes.models import ContentType
from rest_framework import serializers

from .models import Collection, Uri
from .models import Uri

from apis_core.generic.serializers import GenericHyperlinkedModelSerializer


class CollectionSerializer(serializers.HyperlinkedModelSerializer):
url = serializers.HyperlinkedIdentityField(
view_name="apis:apis_api:text-detail", lookup_field="pk"
)
collection_type = serializers.HyperlinkedRelatedField(
view_name="apis:apis_api:collectiontype-detail",
lookup_field="pk",
read_only=True,
)
parent_class = serializers.HyperlinkedRelatedField(
view_name="apis:apis_api:collection-detail", lookup_field="pk", read_only=True
)

class Meta:
fields = ["url", "name", "description", "collection_type", "parent_class"]
model = Collection


class UriSerializer(GenericHyperlinkedModelSerializer):
url = serializers.HyperlinkedIdentityField(
view_name="apis:apis_api:uri-detail", lookup_field="pk"
Expand All @@ -32,13 +13,3 @@ class UriSerializer(GenericHyperlinkedModelSerializer):
class Meta:
fields = "__all__"
model = Uri


class ContentTypeSerializer(serializers.HyperlinkedModelSerializer):
url = serializers.HyperlinkedIdentityField(
view_name="apis:apis_api:contenttype-detail", lookup_field="pk"
)

class Meta:
fields = "__all__"
model = ContentType
1 change: 0 additions & 1 deletion apis_core/apis_relations/tests.py

This file was deleted.

146 changes: 0 additions & 146 deletions apis_core/testrunners.py

This file was deleted.

0 comments on commit 8124531

Please sign in to comment.