Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
tianlh
LightGBM-DCU
Commits
d9a4cf49
Unverified
Commit
d9a4cf49
authored
Nov 22, 2023
by
James Lamb
Committed by
GitHub
Nov 22, 2023
Browse files
[python-package] ignore mypy errors related to ctypes string buffers (#6198)
parent
18dbd65e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
python-package/lightgbm/basic.py
python-package/lightgbm/basic.py
+6
-6
No files found.
python-package/lightgbm/basic.py
View file @
d9a4cf49
...
...
@@ -2948,7 +2948,7 @@ class Dataset:
reserved_string_buffer_size
=
255
required_string_buffer_size
=
ctypes
.
c_size_t
(
0
)
string_buffers
=
[
ctypes
.
create_string_buffer
(
reserved_string_buffer_size
)
for
_
in
range
(
num_feature
)]
ptr_string_buffers
=
(
ctypes
.
c_char_p
*
num_feature
)(
*
map
(
ctypes
.
addressof
,
string_buffers
))
ptr_string_buffers
=
(
ctypes
.
c_char_p
*
num_feature
)(
*
map
(
ctypes
.
addressof
,
string_buffers
))
# type: ignore[misc]
_safe_call
(
_LIB
.
LGBM_DatasetGetFeatureNames
(
self
.
_handle
,
ctypes
.
c_int
(
num_feature
),
...
...
@@ -2962,7 +2962,7 @@ class Dataset:
# if buffer length is not long enough, reallocate buffers
if
reserved_string_buffer_size
<
actual_string_buffer_size
:
string_buffers
=
[
ctypes
.
create_string_buffer
(
actual_string_buffer_size
)
for
_
in
range
(
num_feature
)]
ptr_string_buffers
=
(
ctypes
.
c_char_p
*
num_feature
)(
*
map
(
ctypes
.
addressof
,
string_buffers
))
ptr_string_buffers
=
(
ctypes
.
c_char_p
*
num_feature
)(
*
map
(
ctypes
.
addressof
,
string_buffers
))
# type: ignore[misc]
_safe_call
(
_LIB
.
LGBM_DatasetGetFeatureNames
(
self
.
_handle
,
ctypes
.
c_int
(
num_feature
),
...
...
@@ -4628,7 +4628,7 @@ class Booster:
reserved_string_buffer_size
=
255
required_string_buffer_size
=
ctypes
.
c_size_t
(
0
)
string_buffers
=
[
ctypes
.
create_string_buffer
(
reserved_string_buffer_size
)
for
_
in
range
(
num_feature
)]
ptr_string_buffers
=
(
ctypes
.
c_char_p
*
num_feature
)(
*
map
(
ctypes
.
addressof
,
string_buffers
))
ptr_string_buffers
=
(
ctypes
.
c_char_p
*
num_feature
)(
*
map
(
ctypes
.
addressof
,
string_buffers
))
# type: ignore[misc]
_safe_call
(
_LIB
.
LGBM_BoosterGetFeatureNames
(
self
.
_handle
,
ctypes
.
c_int
(
num_feature
),
...
...
@@ -4642,7 +4642,7 @@ class Booster:
# if buffer length is not long enough, reallocate buffers
if
reserved_string_buffer_size
<
actual_string_buffer_size
:
string_buffers
=
[
ctypes
.
create_string_buffer
(
actual_string_buffer_size
)
for
_
in
range
(
num_feature
)]
ptr_string_buffers
=
(
ctypes
.
c_char_p
*
num_feature
)(
*
map
(
ctypes
.
addressof
,
string_buffers
))
ptr_string_buffers
=
(
ctypes
.
c_char_p
*
num_feature
)(
*
map
(
ctypes
.
addressof
,
string_buffers
))
# type: ignore[misc]
_safe_call
(
_LIB
.
LGBM_BoosterGetFeatureNames
(
self
.
_handle
,
ctypes
.
c_int
(
num_feature
),
...
...
@@ -4852,7 +4852,7 @@ class Booster:
string_buffers
=
[
ctypes
.
create_string_buffer
(
reserved_string_buffer_size
)
for
_
in
range
(
self
.
__num_inner_eval
)
]
ptr_string_buffers
=
(
ctypes
.
c_char_p
*
self
.
__num_inner_eval
)(
*
map
(
ctypes
.
addressof
,
string_buffers
))
ptr_string_buffers
=
(
ctypes
.
c_char_p
*
self
.
__num_inner_eval
)(
*
map
(
ctypes
.
addressof
,
string_buffers
))
# type: ignore[misc]
_safe_call
(
_LIB
.
LGBM_BoosterGetEvalNames
(
self
.
_handle
,
ctypes
.
c_int
(
self
.
__num_inner_eval
),
...
...
@@ -4868,7 +4868,7 @@ class Booster:
string_buffers
=
[
ctypes
.
create_string_buffer
(
actual_string_buffer_size
)
for
_
in
range
(
self
.
__num_inner_eval
)
]
ptr_string_buffers
=
(
ctypes
.
c_char_p
*
self
.
__num_inner_eval
)(
*
map
(
ctypes
.
addressof
,
string_buffers
))
ptr_string_buffers
=
(
ctypes
.
c_char_p
*
self
.
__num_inner_eval
)(
*
map
(
ctypes
.
addressof
,
string_buffers
))
# type: ignore[misc]
_safe_call
(
_LIB
.
LGBM_BoosterGetEvalNames
(
self
.
_handle
,
ctypes
.
c_int
(
self
.
__num_inner_eval
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment