8000 Fix mypy errors. by ccl-core · Pull Request #890 · mlcommons/croissant · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix mypy errors. #890

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 12, 2025
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -403,20 +403,27 @@ def from_jsonld(cls, ctx: Context, jsonld: Json):
ctx=ctx,
id=uuid_from_jsonld(jsonld),
jsonld=jsonld,
**kwargs,
**kwargs, # type: ignore[arg-type]
)

JSONLD_TYPE: Callable[[Context], term.URIRef] | term.URIRef | str | None = (
_MISSING_JSONLD_TYPE
)
JSONLD_TYPE: (
Callable[[Context], term.URIRef]
| Callable[[], term.URIRef]
| term.URIRef
| str
| None
) = _MISSING_JSONLD_TYPE

@classmethod
def _jsonld_type(cls, ctx: Context):
"""Get the actual JSON-LD type according the the ctx."""
if cls.JSONLD_TYPE == _MISSING_JSONLD_TYPE:
raise NotImplementedError("Output the right JSON-LD type.")
elif callable(cls.JSONLD_TYPE):
return cls.JSONLD_TYPE(ctx)
sig = inspect.signature(cls.JSONLD_TYPE)
if len(sig.parameters) == 1:
return cls.JSONLD_TYPE(ctx) # type: ignore[call-arg]
return cls.JSONLD_TYPE() # type: ignore[call-arg]
else:
return cls.JSONLD_TYPE

Expand Down
0