Skip to content

Commit f287c04

Browse files
committed
flake8 - again
1 parent cd9bc61 commit f287c04

File tree

11 files changed

+19
-27
lines changed

11 files changed

+19
-27
lines changed

trove/admin.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class IndexcardAdmin(admin.ModelAdmin): # type: ignore
5555

5656
def _freshen_index(self, queryset: list[Indexcard]) -> None:
5757
IndexMessenger().notify_indexcard_update(queryset)
58-
_freshen_index.short_description = 'freshen indexcard in search index' # type: ignore
58+
_freshen_index.short_description = 'freshen indexcard in search index' # type: ignore
5959

6060

6161
@admin.register(LatestIndexcardRdf, site=admin_site)
@@ -77,7 +77,7 @@ class LatestIndexcardRdfAdmin(admin.ModelAdmin): # type: ignore
7777

7878
def rdf_as_turtle__pre(self, instance: Any) -> str:
7979
return format_html('<pre>{}</pre>', instance.rdf_as_turtle)
80-
rdf_as_turtle__pre.short_description = 'rdf as turtle' # type: ignore[attr-defined]
80+
rdf_as_turtle__pre.short_description = 'rdf as turtle' # type: ignore[attr-defined]
8181

8282

8383
@admin.register(ArchivedIndexcardRdf, site=admin_site)
@@ -99,7 +99,7 @@ class ArchivedIndexcardRdfAdmin(admin.ModelAdmin): # type: ignore
9999

100100
def rdf_as_turtle__pre(self, instance: Any) -> str:
101101
return format_html('<pre>{}</pre>', instance.rdf_as_turtle)
102-
rdf_as_turtle__pre.short_description = 'rdf as turtle' # type: ignore[attr-defined]
102+
rdf_as_turtle__pre.short_description = 'rdf as turtle' # type: ignore[attr-defined]
103103

104104

105105
@admin.register(SupplementaryIndexcardRdf, site=admin_site)
@@ -122,7 +122,7 @@ class SupplementaryIndexcardRdfAdmin(admin.ModelAdmin): # type: ignore
122122

123123
def rdf_as_turtle__pre(self, instance: SupplementaryIndexcardRdf) -> str:
124124
return format_html('<pre>{}</pre>', instance.rdf_as_turtle)
125-
rdf_as_turtle__pre.short_description = 'rdf as turtle' # type: ignore[attr-defined]
125+
rdf_as_turtle__pre.short_description = 'rdf as turtle' # type: ignore[attr-defined]
126126

127127

128128
@admin.register(DerivedIndexcard, site=admin_site)

trove/derive/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@
1818
)
1919

2020
DeriverType = Type[
21-
sharev2_elastic.ShareV2ElasticDeriver |
22-
osfmap_json.OsfmapJsonDeriver |
23-
oaidc_xml.OaiDcXmlDeriver
21+
sharev2_elastic.ShareV2ElasticDeriver | osfmap_json.OsfmapJsonDeriver | oaidc_xml.OaiDcXmlDeriver
2422
]
2523

2624

trove/derive/osfmap_json.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def __nested_rdfobject_as_jsonld(
130130
self.__nestvisiting_iris.discard(rdfobject)
131131
return _nested_obj
132132

133-
def _list_or_single_value(self,predicate_iri: str,json_list: List[Any]) -> Optional[Union[Any, List[Any]]]:
133+
def _list_or_single_value(self, predicate_iri: str, json_list: List[Any]) -> Optional[Union[Any, List[Any]]]:
134134
_only_one_object = OWL.FunctionalProperty in (
135135
OSFMAP_THESAURUS
136136
.get(predicate_iri, {})

trove/derive/sharev2_elastic.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ class ShareV2ElasticDeriver(IndexcardDeriver):
128128
# abstract method from IndexcardDeriver
129129
@staticmethod
130130
def deriver_iri() -> str:
131-
return SHAREv2.sharev2_elastic # type: ignore
131+
return SHAREv2.sharev2_elastic # type: ignore
132132

133133
# abstract method from IndexcardDeriver
134134
@staticmethod
@@ -152,7 +152,7 @@ def should_skip(self) -> bool:
152152
def derive_card_as_text(self) -> str:
153153
_suid = self.upriver_rdf.indexcard.source_record_suid
154154
try: # maintain doc id in the sharev2 index
155-
_suid = _suid.get_backcompat_sharev2_suid() # type: ignore
155+
_suid = _suid.get_backcompat_sharev2_suid() # type: ignore
156156
except share_db.SourceUniqueIdentifier.DoesNotExist:
157157
pass # ok, use the actual suid
158158
_source_name = _suid.source_config.source.long_title
@@ -163,7 +163,7 @@ def derive_card_as_text(self) -> str:
163163
'id': IDObfuscator.encode(_suid),
164164
'indexcard_id': self.upriver_rdf.indexcard.id,
165165
'rawdatum_id': self.upriver_rdf.from_raw_datum_id,
166-
'date_created': _suid.get_date_first_seen().isoformat(), # type: ignore
166+
'date_created': _suid.get_date_first_seen().isoformat(), # type: ignore
167167
'date_modified': self.upriver_rdf.modified.isoformat(),
168168
'sources': [_source_name],
169169
'source_config': _suid.source_config.label,
@@ -271,7 +271,7 @@ def _osf_related_resource_types(self) -> dict[str, bool]:
271271
for _key, _pred in _osf_artifact_types.items()
272272
}
273273

274-
def _related_agent_list(self, *predicate_iris: str, focus_iri: Optional[str]=None) -> List[Dict[str, Any]]:
274+
def _related_agent_list(self, *predicate_iris: str, focus_iri: Optional[str] = None) -> List[Dict[str, Any]]:
275275
_agent_list = []
276276
for _predicate_iri in predicate_iris:
277277
_agent_iri_iter = self.data.q(

trove/extract/turtle.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44

55

66
class TurtleRdfExtractor(BaseRdfExtractor):
7-
def extract_rdf(self, input_document: str): # type: ignore
7+
def extract_rdf(self, input_document: str): # type: ignore
88
return primitive_rdf.tripledict_from_turtle(input_document)

trove/models/resource_identifier.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def validate_sufficiently_unique_iri(suffuniq_iri: str) -> None:
5353

5454

5555
class ResourceIdentifierManager(models.Manager): # type: ignore
56-
def queryset_for_iri(self, iri: str) -> 'QuerySet["ResourceIdentifier"]':
56+
def queryset_for_iri(self, iri: str) -> 'QuerySet["ResourceIdentifier"]':
5757
return self.queryset_for_iris((iri,))
5858

5959
def queryset_for_iris(self, iris: typing.Iterable[str]) -> 'QuerySet["ResourceIdentifier"]':

trove/render/__init__.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,7 @@
2626
)
2727

2828
RendersType = Type[
29-
BaseRenderer |
30-
RdfHtmlBrowseRenderer |
31-
RdfJsonapiRenderer |
32-
RdfTurtleRenderer |
33-
RdfJsonldRenderer |
34-
TrovesearchSimpleCsvRenderer |
35-
TrovesearchSimpleJsonRenderer |
36-
TrovesearchSimpleTsvRenderer
29+
BaseRenderer | RdfHtmlBrowseRenderer | RdfJsonapiRenderer | RdfTurtleRenderer | RdfJsonldRenderer | TrovesearchSimpleCsvRenderer | TrovesearchSimpleJsonRenderer | TrovesearchSimpleTsvRenderer
3730
]
3831

3932
RENDERER_BY_MEDIATYPE = {

trove/render/jsonapi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def simple_render_document(self) -> str:
8888
)
8989

9090
def render_dict(self, primary_iris: Union[str, Iterable[str]]) -> dict[str, Any]:
91-
_primary_data: dict | list | None = None # type: ignore
91+
_primary_data: dict | list | None = None # type: ignore
9292
_included_data = []
9393
with self._contained__to_include() as _to_include:
9494
if isinstance(primary_iris, str):

trove/trovesearch/page_cursor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,14 @@ class ReproduciblyRandomSampleCursor(OffsetCursor):
132132

133133
def next_cursor(self) -> ReproduciblyRandomSampleCursor | None:
134134
return (
135-
super().next_cursor() # type: ignore
135+
super().next_cursor() # type: ignore
136136
if self.first_page_ids
137137
else None
138138
)
139139

140140
def prev_cursor(self) -> ReproduciblyRandomSampleCursor | None:
141141
return (
142-
super().prev_cursor() # type: ignore
142+
super().prev_cursor() # type: ignore
143143
if self.first_page_ids
144144
else None
145145
)

trove/trovesearch/search_params.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ def iter_from_queryparam_family(cls, queryparams: QueryparamDict, queryparam_fam
235235
yield from cls.iter_from_searchtext_param(_param_name, _param_value)
236236

237237
@classmethod
238-
def iter_from_searchtext_param(cls, param_name: QueryparamName, param_value: str)-> Iterator[Textsegment]:
238+
def iter_from_searchtext_param(cls, param_name: QueryparamName, param_value: str) -> Iterator[Textsegment]:
239239
_propertypath_set = (
240240
_parse_propertypath_set(param_name.bracketed_names[0])
241241
if param_name.bracketed_names
@@ -376,7 +376,7 @@ def from_shortname(cls, shortname: str) -> typing.Self:
376376
_iri = trove_shorthand().expand_iri(shortname)
377377
return cls(_iri)
378378

379-
def to_shortname(self) -> IriShorthand: # type: ignore
379+
def to_shortname(self) -> str: # type: ignore
380380
return trove_shorthand().compact_iri(self.value)
381381

382382
def is_date_operator(self) -> bool:

0 commit comments

Comments
 (0)