Skip to content
Open
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
1 change: 1 addition & 0 deletions python-package/lightgbm/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ def _np2d_to_np1d(mat: np.ndarray) -> Tuple[np.ndarray, int]:
dtype = mat.dtype
else:
dtype = np.float32
order: Literal["C", "F"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tried running lightgbm's tests locally?

I think this is going to fail because typing.Literal is not imported at runtime, only type-checking time:

if TYPE_CHECKING:
from typing import Literal

You'll need to either move that import up alongside the other runtime ones or change this to deferred evaluation like this:

order: "Literal['C', 'F']"

Either is fine with me.

if mat.flags["F_CONTIGUOUS"]:
order = "F"
layout = _C_API_IS_COL_MAJOR
Expand Down