You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Run the code through pylint to get general feedback on Python coding conventions and also basic bugs you might not otherwise catch
E.g.: one example I see is you shouldn't use type(x) == T; use instead isinstance(x, T).
Obviously this is secondary to getting the code working and performant, but it's always easier to start early rather than build up a large codebase and then check with pylint.
FTYPE should be a single global value, and should not be changed. Function / parameter names should be all lower-case (possibly with underscores) and NOT be the same as the "globals" e.g. FTYPE. FTYPE so a function can take an argument ftype but be assigned the global FTYPE as a default, but within the function, it should make use of ftype. I.e.: func(x, y, ftype=FTYPE) is workable. func(x, y, FTYPE) or using FTYPE within the function if FTYPE is ever to be changed is not workable.
n_events argument indicates "number of events" yet there is also a number_of_events argument (GPUHist class / method(s))
Think through the logic of testing and implement it modularly; as it stands, there's a lot of copy-paste code in there, and things doing odd things with peculiar arguments to functions (e.g. creating an array NOT on the gpu (create_array(device_array=False)) returns a second value (usually reserved for a gpu-based array), but it's just a regular numpy array... then your subsequent code assignes that value to a variable d_input_data and might or might not work with it).
The text was updated successfully, but these errors were encountered:
type(x) == T
; use insteadisinstance(x, T)
.Obviously this is secondary to getting the code working and performant, but it's always easier to start early rather than build up a large codebase and then check with pylint.
ftype
but be assigned the globalFTYPE
as a default, but within the function, it should make use offtype
. I.e.:func(x, y, ftype=FTYPE)
is workable.func(x, y, FTYPE)
or using FTYPE within the function if FTYPE is ever to be changed is not workable.n_events
argument indicates "number of events" yet there is also anumber_of_events
argument (GPUHist class / method(s))create_array(device_array=False)
) returns a second value (usually reserved for a gpu-based array), but it's just a regular numpy array... then your subsequent code assignes that value to a variabled_input_data
and might or might not work with it).The text was updated successfully, but these errors were encountered: