Skip to content

Commit

Permalink
precommit fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
DerThorsten committed Jan 19, 2024
1 parent c254432 commit 554431d
Show file tree
Hide file tree
Showing 16 changed files with 86 additions and 90 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,21 @@ jobs:
- name: Setup emsdk
shell: bash -l {0}
run: |
emsdk install ${{ matrix.emsdk_ver }}
################################################################
# C++ build
################################################################
- name: Build
shell: bash -l {0}
run: |
emsdk activate ${{ matrix.emsdk_ver }}
source $CONDA_EMSDK_DIR/emsdk_env.sh
micromamba create -f environment-wasm-host.yml --platform=emscripten-wasm32
mkdir build
pushd build
Expand All @@ -67,7 +67,7 @@ jobs:
-DCMAKE_INSTALL_PREFIX=$PREFIX \
-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON \
..
make -j${{ steps.cpu-cores.outputs.count }} install
################################################################
Expand All @@ -80,10 +80,10 @@ jobs:
# build jupyterlite
jupyter lite build \
--contents=notebooks \
--XeusAddon.prefix=$PREFIX
--XeusAddon.prefix=$PREFIX
################################################################
# fix permissions
################################################################
Expand Down
9 changes: 4 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU"
if(NOT EMSCRIPTEN)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wunused-parameter -Wextra -Wreorder")
endif()


CHECK_CXX_COMPILER_FLAG("-std=c++17" HAS_CPP_17_FLAG)
if (HAS_CPP_17_FLAG)
Expand Down Expand Up @@ -183,7 +183,7 @@ macro(xeus_javascript_set_kernel_options target_name)
find_package(Threads)
target_link_libraries(${target_name} PRIVATE ${CMAKE_THREAD_LIBS_INIT})
endif()

endmacro()

# Common macro for shared and static library
Expand Down Expand Up @@ -229,7 +229,7 @@ macro(xeus_javascript_create_target target_name linkage output_name)
find_package(Threads) # TODO: add Threads as a dependence of xeus-static?
target_link_libraries(${target_name} PRIVATE ${CMAKE_THREAD_LIBS_INIT})
endif()

endmacro()

# xeus-javascript
Expand Down Expand Up @@ -278,7 +278,7 @@ if(EMSCRIPTEN)
xeus_wasm_compile_options(xjavascript)
xeus_wasm_link_options(xjavascript "web,worker")

#
#
target_link_options(xjavascript
PUBLIC "SHELL: -s NO_EXIT_RUNTIME=1"
PUBLIC "SHELL: -s ASYNCIFY"
Expand Down Expand Up @@ -369,4 +369,3 @@ if(EMSCRIPTEN)
"$<TARGET_FILE_DIR:xjavascript>/xjavascript.wasm"
DESTINATION ${CMAKE_INSTALL_BINDIR})
endif ()

2 changes: 1 addition & 1 deletion docs/source/conda.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 2 additions & 3 deletions docs/source/dev-build-options.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.. Copyright (c) 2024,
.. Copyright (c) 2024,
Distributed under the terms of the BSD 3-Clause License.
Distributed under the terms of the BSD 3-Clause License.
The full license is in the file LICENSE, distributed with this software.
Expand Down Expand Up @@ -35,4 +35,3 @@ Building the Tests
~~~~~~~~~~~~~~~~~~

- ``XEUS_JAVASCRIPT_BUILD_TESTS ``: enables the tets **Disabled by default**.
8 changes: 4 additions & 4 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.. Copyright (c) 2024,
.. Copyright (c) 2024,
Distributed under the terms of the BSD 3-Clause License.
Distributed under the terms of the BSD 3-Clause License.
The full license is in the file LICENSE, distributed with this software.
Expand All @@ -11,13 +11,13 @@
Introduction
------------

``xeus-javascript`` is a Jupyter kernel for javascript based on the native implementation of the Jupyter protocol
``xeus-javascript`` is a Jupyter kernel for javascript based on the native implementation of the Jupyter protocol
xeus_.

Licensing
---------

Distributed under the terms of the BSD 3-Clause License.
Distributed under the terms of the BSD 3-Clause License.

The full license is in the file LICENSE, distributed with this software.

Expand Down
2 changes: 1 addition & 1 deletion docs/source/quantstack-white.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion docs/source/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,3 @@ And of course widgets

.. image:: binary.gif
:alt: widgets_binary

40 changes: 20 additions & 20 deletions docs/source/xeus-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ dependencies:
- xeus-javascript=0.1.0
- notebook
- ipywidgets>=7.6
- jupyterlab=3
- jupyterlab=3
12 changes: 6 additions & 6 deletions include/xeus-javascript/xeus_javascript_config.hpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/***************************************************************************
* Copyright (c) 2024, Thorsten Beier
*
* Distributed under the terms of the BSD 3-Clause License.
*
* The full license is in the file LICENSE, distributed with this software.
* Copyright (c) 2024, Thorsten Beier
*
* Distributed under the terms of the BSD 3-Clause License.
*
* The full license is in the file LICENSE, distributed with this software.
****************************************************************************/

#ifndef XEUS_JAVASCRIPT_CONFIG_HPP
Expand Down Expand Up @@ -34,4 +34,4 @@
#define XEUS_JAVASCRIPT_API
#endif

#endif
#endif
12 changes: 6 additions & 6 deletions include/xeus-javascript/xinterpreter.hpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/***************************************************************************
* Copyright (c) 2024, Thorsten Beier
*
* Distributed under the terms of the BSD 3-Clause License.
*
* The full license is in the file LICENSE, distributed with this software.
* Copyright (c) 2024, Thorsten Beier
*
* Distributed under the terms of the BSD 3-Clause License.
*
* The full license is in the file LICENSE, distributed with this software.
****************************************************************************/


Expand All @@ -28,7 +28,7 @@ namespace nl = nlohmann;

namespace xeus_javascript
{

void publish_stdout_stream(const std::string& message);
void publish_stderr_stream(const std::string& message);
void display_data(const std::string& json_str);
Expand Down
2 changes: 1 addition & 1 deletion share/jupyter/kernels/xjavascript/logo-svg.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 5 additions & 6 deletions src/main_emscripten_kernel.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/***************************************************************************
* Copyright (c) 2024, Thorsten Beier
*
* Distributed under the terms of the BSD 3-Clause License.
*
* The full license is in the file LICENSE, distributed with this software.
* Copyright (c) 2024, Thorsten Beier
*
* Distributed under the terms of the BSD 3-Clause License.
*
* The full license is in the file LICENSE, distributed with this software.
****************************************************************************/

#include <iostream>
Expand All @@ -27,4 +27,3 @@ EMSCRIPTEN_BINDINGS(my_module) {
emscripten::function("_display_data", &xeus_javascript::display_data);

}

14 changes: 7 additions & 7 deletions src/pre.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Module["_call_user_code"] = async function (code) {


Module["_complete_line"] = function (code_line){

// remove unwanted left part:
// ie if code is " if(postM)" then remove " if("
// ie if code is " postM" then remove " "
Expand All @@ -70,11 +70,11 @@ Module["_complete_line"] = function (code_line){
}
}
let pseudo_expression = code_line.substring(code_begin);


// pseudo_expression is "fubar.b" "fubar", "fubar." or "fubar['aaa']"

// find part right of dot / bracket
// find part right of dot / bracket
// start searching from the right
const exp_stop_chars = ".]";

Expand Down Expand Up @@ -142,7 +142,7 @@ Module["_complete_request"] = function (code, curser_pos){
let line_index = 0;
let curser_pos_in_line = 0;
let line_begin = 0;

// loop over lines
for (let i = 0; i < lines.length; i++) {
if( curser_pos>=line_begin && curser_pos<=line_begin+lines[i].length){
Expand All @@ -166,14 +166,14 @@ Module["_complete_request"] = function (code, curser_pos){
let line_res = Module["_complete_line"](code_line);
let matches = line_res.matches;
let in_line_cursor_start = line_res.cursor_start;

let return_obj = {
matches : matches,
cursor_start : line_begin + in_line_cursor_start,
cursor_end : curser_pos,
status: line_res.status || "ok"
};

return JSON.stringify(return_obj);

}
Expand Down Expand Up @@ -208,4 +208,4 @@ Module['ijs'] = {
this._display({ "text/latex": latex });
}
},
}
}
Loading

0 comments on commit 554431d

Please sign in to comment.