Skip to content

Commit 4b8195b

Browse files
committed
Some linting for 2024
1 parent 09b1b7f commit 4b8195b

File tree

4 files changed

+12
-23
lines changed

4 files changed

+12
-23
lines changed

optimade/models/files.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# pylint: disable=no-self-argument,line-too-long,no-name-in-module
22
from datetime import datetime
3-
from typing import Dict, Optional, Set, Tuple
3+
from typing import Optional
44

55
from optimade.models.entries import EntryResource, EntryResourceAttributes
66
from optimade.models.utils import OptimadeField, StrictField, SupportLevel
@@ -11,7 +11,7 @@
1111
)
1212

1313

14-
CORRELATED_FILE_FIELDS: Tuple[Set[str], ...]
14+
CORRELATED_FILE_FIELDS: tuple[set[str], ...]
1515

1616

1717
class FileResourceAttributes(EntryResourceAttributes):
@@ -142,7 +142,7 @@ class FileResourceAttributes(EntryResourceAttributes):
142142
queryable=SupportLevel.OPTIONAL,
143143
)
144144

145-
checksums: Optional[Dict[str, str]] = OptimadeField(
145+
checksums: Optional[dict[str, str]] = OptimadeField(
146146
...,
147147
description="""Dictionary providing checksums of file contents.
148148
* **Type**: dictionary with keys identifying checksum functions and values (strings) giving the actual checksums
@@ -217,7 +217,7 @@ class FileResource(EntryResource):
217217
218218
- **Examples**:
219219
- `"structures"`""",
220-
regex="^files$",
220+
pattern="^files$",
221221
support=SupportLevel.MUST,
222222
queryable=SupportLevel.MUST,
223223
)

optimade/models/responses.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,13 @@ class StructureResponseMany(EntryResponseMany):
141141

142142

143143
class FileResponseOne(EntryResponseOne):
144-
data: Union[FileResource, Dict[str, Any], None] = StrictField(
144+
data: Union[FileResource, dict[str, Any], None] = StrictField(
145145
..., description="A single files entry resource."
146146
)
147147

148148

149149
class FileResponseMany(EntryResponseMany):
150-
data: Union[List[FileResource], List[Dict[str, Any]]] = StrictField(
150+
data: Union[list[FileResource], list[dict[str, Any]]] = StrictField(
151151
...,
152152
description="List of unique OPTIMADE files entry resource objects.",
153153
uniqueItems=True,

optimade/server/config.py

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -218,22 +218,12 @@ class ServerConfig(BaseSettings):
218218
mongo_uri: Annotated[str, Field(description="URI for the Mongo server")] = (
219219
"localhost:27017"
220220
)
221-
222-
page_limit: int = Field(20, description="Default number of resources per page")
223-
page_limit_max: int = Field(
224-
500, description="Max allowed number of resources per page"
225-
)
226-
default_db: str = Field(
227-
"test_server",
228-
description=(
229-
"ID of /links endpoint resource for the chosen default OPTIMADE implementation (only "
230-
"relevant for the index meta-database)"
231-
)
232-
)
233-
files_collection: str = Field(
234-
"files",
235-
description="Mongo collection name for /files endpoint resources",
236-
)
221+
files_collection: Annotated[
222+
str,
223+
Field(
224+
description="Mongo collection name for /files endpoint resources",
225+
),
226+
] = "files"
237227
links_collection: Annotated[
238228
str, Field(description="Mongo collection name for /links endpoint resources")
239229
] = "links"

optimade/server/mappers/files.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@
55

66

77
class FileMapper(BaseResourceMapper):
8-
98
ENTRY_RESOURCE_CLASS = FileResource

0 commit comments

Comments
 (0)