Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeSheard committed Jan 12, 2019
1 parent 6987434 commit 16adf83
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 51 deletions.
10 changes: 4 additions & 6 deletions packages/perspective-jupyterlab/src/config/plugin.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@ module.exports = {
extensions: [".ts", ".js", ".json"]
},
externals: /\@jupyter|\@phosphor/,
plugins: [
new webpack.ContextReplacementPlugin(/moment[\/\\]locale$/, /(en|es|fr)$/),
new PerspectivePlugin()
],
plugins: [new webpack.ContextReplacementPlugin(/moment[\/\\]locale$/, /(en|es|fr)$/), new PerspectivePlugin()],
module: {
rules: [
{
Expand Down Expand Up @@ -57,14 +54,15 @@ module.exports = {
{
test: /\.js$/,
exclude: /node_modules[/\\](?!\@jpmorganchase)|psp\.(asmjs|async|sync)\.js|perspective\.(asmjs|wasm)\.worker\.js/,
loader: "babel-loader",
loader: "babel-loader"
},
{
test: /\.css$/,
use: [{loader: "css-loader"}]
},
{
test: /\.ts?$/, loader: "ts-loader"
test: /\.ts?$/,
loader: "ts-loader"
}
]
},
Expand Down
3 changes: 1 addition & 2 deletions packages/perspective-viewer/src/less/viewer.less
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,7 @@
#inactive_columns {
perspective-row {
opacity: var(--inactive-column--opacity, 1);
transition: opacity 0.3s;
// --row_draggable--transition: margin-left 0.5s;
transition: opacity 0.3s; // --row_draggable--transition: margin-left 0.5s;
&.active {
--row_draggable--margin: 0px 0px 0px 10px;
opacity: 0;
Expand Down
3 changes: 1 addition & 2 deletions src/cpp/column.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -923,8 +923,7 @@ t_column::borrow_vocabulary(const t_column& o) {

#ifdef PSP_ENABLE_PYTHON
np::ndarray
t_column::_as_numpy()
{
t_column::_as_numpy() {
if (is_vlen_dtype(m_dtype))
return m_data->_as_numpy(DTYPE_UINT64);
return m_data->_as_numpy(m_dtype);
Expand Down
39 changes: 17 additions & 22 deletions src/cpp/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,8 @@ col_to_js_typed_array(T ctx, t_index idx) {
}

void
_fill_col_numeric(val accessor, t_table& tbl, std::shared_ptr<t_column> col, std::string name, std::int32_t cidx, t_dtype type,
bool is_arrow) {
_fill_col_numeric(val accessor, t_table& tbl, std::shared_ptr<t_column> col, std::string name,
std::int32_t cidx, t_dtype type, bool is_arrow) {
t_uindex nrows = col->size();

if (is_arrow) {
Expand Down Expand Up @@ -453,7 +453,7 @@ _fill_col_numeric(val accessor, t_table& tbl, std::shared_ptr<t_column> col, std
col->set_nth(i, fval);
} else {
col->set_nth(i, static_cast<std::int32_t>(fval));
}
}
} break;
case DTYPE_FLOAT32: {
col->set_nth(i, item.as<float>());
Expand All @@ -469,8 +469,8 @@ _fill_col_numeric(val accessor, t_table& tbl, std::shared_ptr<t_column> col, std
}

void
_fill_col_int64(val accessor, std::shared_ptr<t_column> col, std::string name, std::int32_t cidx, t_dtype type,
bool is_arrow) {
_fill_col_int64(val accessor, std::shared_ptr<t_column> col, std::string name,
std::int32_t cidx, t_dtype type, bool is_arrow) {
t_uindex nrows = col->size();

if (is_arrow) {
Expand All @@ -484,8 +484,8 @@ _fill_col_int64(val accessor, std::shared_ptr<t_column> col, std::string name, s
}

void
_fill_col_time(val accessor, std::shared_ptr<t_column> col, std::string name, std::int32_t cidx, t_dtype type,
bool is_arrow) {
_fill_col_time(val accessor, std::shared_ptr<t_column> col, std::string name, std::int32_t cidx,
t_dtype type, bool is_arrow) {
t_uindex nrows = col->size();

if (is_arrow) {
Expand Down Expand Up @@ -526,8 +526,8 @@ _fill_col_time(val accessor, std::shared_ptr<t_column> col, std::string name, st
}

void
_fill_col_date(val accessor, std::shared_ptr<t_column> col, std::string name, std::int32_t cidx, t_dtype type,
bool is_arrow) {
_fill_col_date(val accessor, std::shared_ptr<t_column> col, std::string name, std::int32_t cidx,
t_dtype type, bool is_arrow) {
t_uindex nrows = col->size();

if (is_arrow) {
Expand Down Expand Up @@ -566,8 +566,8 @@ _fill_col_date(val accessor, std::shared_ptr<t_column> col, std::string name, st
}

void
_fill_col_bool(val accessor, std::shared_ptr<t_column> col, std::string name, std::int32_t cidx, t_dtype type,
bool is_arrow) {
_fill_col_bool(val accessor, std::shared_ptr<t_column> col, std::string name, std::int32_t cidx,
t_dtype type, bool is_arrow) {
t_uindex nrows = col->size();

if (is_arrow) {
Expand Down Expand Up @@ -597,8 +597,8 @@ _fill_col_bool(val accessor, std::shared_ptr<t_column> col, std::string name, st
}

void
_fill_col_string(val accessor, std::shared_ptr<t_column> col, std::string name, std::int32_t cidx, t_dtype type,
bool is_arrow) {
_fill_col_string(val accessor, std::shared_ptr<t_column> col, std::string name,
std::int32_t cidx, t_dtype type, bool is_arrow) {

t_uindex nrows = col->size();

Expand Down Expand Up @@ -944,11 +944,8 @@ column_names(val data, std::int32_t format) {
<< std::endl;
}

std::cout << "Extending from "
<< data_names["length"].as<std::int32_t>()
<< "to "
<< next["length"].as<std::int32_t>()
<< std::endl;
std::cout << "Extending from " << data_names["length"].as<std::int32_t>()
<< "to " << next["length"].as<std::int32_t>() << std::endl;
data_names = next;
max_check *= 2;
}
Expand All @@ -970,10 +967,8 @@ infer_type(val x, val date_validator) {

// Unwrap numbers inside strings
val x_number = val::global("Number").call<val>("call", val::object(), x);
bool number_in_string = (jstype == "string")
&& (x["length"].as<std::int32_t>() != 0)
&& (!val::global("isNaN")
.call<bool>("call", val::object(), x_number));
bool number_in_string = (jstype == "string") && (x["length"].as<std::int32_t>() != 0)
&& (!val::global("isNaN").call<bool>("call", val::object(), x_number));

if (x.isNull()) {
t = t_dtype::DTYPE_NONE;
Expand Down
2 changes: 1 addition & 1 deletion src/cpp/schema.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ t_schema::add_column(const std::string& colname, t_dtype dtype) {

void
t_schema::retype_column(const std::string& colname, t_dtype dtype) {
if(colname == std::string("psp_pkey") || colname == std::string("psp_op")) {
if (colname == std::string("psp_pkey") || colname == std::string("psp_op")) {
PSP_COMPLAIN_AND_ABORT("Cannot retype primary key or operation columns.");
}
if (!has_column(colname)) {
Expand Down
17 changes: 5 additions & 12 deletions src/cpp/storage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -593,27 +593,20 @@ t_lstore::clone() const {

#ifdef PSP_ENABLE_PYTHON
np::ndarray
t_lstore::_as_numpy(t_dtype dtype)
{
t_lstore::_as_numpy(t_dtype dtype) {
PSP_TRACE_SENTINEL();
PSP_VERBOSE_ASSERT(m_init, "touching uninited object");
PSP_VERBOSE_ASSERT(
dtype != DTYPE_STR,
"as_numpy not implemented for string columns yet");
PSP_VERBOSE_ASSERT(dtype != DTYPE_STR, "as_numpy not implemented for string columns yet");

np::dtype npdtype = get_numpy_typenum_from_dtype(dtype);
py::tuple shape = py::make_tuple(m_size/get_dtype_size(dtype));
py::tuple shape = py::make_tuple(m_size / get_dtype_size(dtype));
py::tuple stride = py::make_tuple(get_dtype_size(dtype));

np::ndarray result = np::from_data(m_base,
npdtype,
shape,
stride,
py::object());
np::ndarray result = np::from_data(m_base, npdtype, shape, stride, py::object());

return result;
// PSP_VERBOSE_ASSERT(rval, "Null array found!");
}
}
#endif

} // end namespace perspective
5 changes: 3 additions & 2 deletions src/cpp/table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -555,9 +555,10 @@ t_table::promote_column(const std::string& name, t_dtype new_dtype, std::int32_t
std::cout << "Promotion only works for int to float." << std::endl;
return;
}

// create the new column and copy data
std::shared_ptr<t_column> promoted_col = make_column(name, new_dtype, current_col->is_status_enabled());
std::shared_ptr<t_column> promoted_col
= make_column(name, new_dtype, current_col->is_status_enabled());
promoted_col->init();
promoted_col->reserve(std::max(size(), std::max(static_cast<t_uindex>(8), m_capacity)));
promoted_col->set_size(size());
Expand Down
2 changes: 1 addition & 1 deletion src/include/perspective/column.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ class PERSPECTIVE_EXPORT t_column {
#ifdef PSP_ENABLE_PYTHON
np::ndarray _as_numpy();
#endif

private:
t_dtype m_dtype;
bool m_init;
Expand Down
1 change: 0 additions & 1 deletion src/include/perspective/first.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
#define PSP_FREE psp_page_aligned_free
#endif


#ifdef PSP_ENABLE_PYTHON
#include <boost/python.hpp>
#include <boost/python/def.hpp>
Expand Down
1 change: 0 additions & 1 deletion src/include/perspective/storage.h
Original file line number Diff line number Diff line change
Expand Up @@ -364,5 +364,4 @@ struct PERSPECTIVE_EXPORT t_column_recipe {
bool m_status_enabled;
};


} // end namespace perspective
2 changes: 1 addition & 1 deletion src/include/perspective/table.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class PERSPECTIVE_EXPORT t_table {

std::shared_ptr<t_column> make_column(
const std::string& colname, t_dtype dtype, bool status_enabled);

void verify() const;
void set_capacity(t_uindex idx);

Expand Down

0 comments on commit 16adf83

Please sign in to comment.