Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Llm example #451

Merged
merged 9 commits into from
Apr 6, 2024
Prev Previous commit
Remove unnecessary condition
haixuanTao committed Apr 4, 2024
commit 3edc3f82093e60af73d67b7f20ff8817bd323211
2 changes: 0 additions & 2 deletions examples/python-operator-dataflow/microphone_op.py
Original file line number Diff line number Diff line change
@@ -31,6 +31,4 @@ def on_event(
audio_data = audio_data.ravel().astype(np.float32) / 32768.0
if len(audio_data) > 0:
send_output("audio", pa.array(audio_data), dora_event["metadata"])
elif dora_event["type"] == "INPUT":
print("Microphone is not recording", dora_event["value"][0].as_py())
return DoraStatus.CONTINUE

Unchanged files with check annotations Beta

}
}
pub unsafe fn from_array(

Check warning on line 57 in libraries/message/src/lib.rs

GitHub Actions / Clippy

unsafe function's docs miss `# Safety` section
array: &ArrayData,
region_start: *const u8,
region_len: usize,
}
impl<T, U> ShmemServer<T, U> {
pub unsafe fn new(memory: Shmem) -> eyre::Result<Self> {

Check warning on line 17 in libraries/shared-memory-server/src/lib.rs

GitHub Actions / Clippy

unsafe function's docs miss `# Safety` section
Ok(Self {
channel: ShmemChannel::new_server(memory)?,
reply_expected: false,
}
impl<T, U> ShmemClient<T, U> {
pub unsafe fn new(memory: Shmem, timeout: Option<Duration>) -> eyre::Result<Self> {

Check warning on line 56 in libraries/shared-memory-server/src/lib.rs

GitHub Actions / Clippy

unsafe function's docs miss `# Safety` section
Ok(Self {
channel: ShmemChannel::new_client(memory)?,
timeout,
let node = Self {
id: node_id,
dataflow_id: dataflow_id,

Check warning on line 93 in apis/rust/node/src/node/mod.rs

GitHub Actions / Clippy

redundant field names in struct initialization
node_config: run_config,
control_channel,
clock,
pub fn dora_free_data(_data: safer_ffi::Vec<u8>) {}
#[ffi_export]
pub unsafe fn dora_send_operator_output(

Check warning on line 178 in apis/rust/operator/types/src/lib.rs

GitHub Actions / Clippy

unsafe function's docs miss `# Safety` section
send_output: &SendOutput,
id: safer_ffi::char_p::char_p_ref<'_>,
data_ptr: *const u8,
pub fn token_stream(&self, gen_cxx_bridge: bool) -> impl ToTokens {
let name = Ident::new(&self.name, Span::call_site());
let messages_block = self.messages_block(gen_cxx_bridge);

Check warning on line 129 in libraries/extensions/ros2-bridge/msg-gen/src/types/package.rs

GitHub Actions / Clippy

unused variable: `gen_cxx_bridge`

Check warning on line 129 in libraries/extensions/ros2-bridge/msg-gen/src/types/package.rs

GitHub Actions / Test (ubuntu-latest)

unused variable: `gen_cxx_bridge`

Check warning on line 129 in libraries/extensions/ros2-bridge/msg-gen/src/types/package.rs

GitHub Actions / Test (ubuntu-latest)

unused variable: `gen_cxx_bridge`

Check warning on line 129 in libraries/extensions/ros2-bridge/msg-gen/src/types/package.rs

GitHub Actions / Test (ubuntu-latest)

unused variable: `gen_cxx_bridge`

Check warning on line 129 in libraries/extensions/ros2-bridge/msg-gen/src/types/package.rs

GitHub Actions / Test (macos-latest)

unused variable: `gen_cxx_bridge`

Check warning on line 129 in libraries/extensions/ros2-bridge/msg-gen/src/types/package.rs

GitHub Actions / Test (macos-latest)

unused variable: `gen_cxx_bridge`

Check warning on line 129 in libraries/extensions/ros2-bridge/msg-gen/src/types/package.rs

GitHub Actions / Test (macos-latest)

unused variable: `gen_cxx_bridge`

Check warning on line 129 in libraries/extensions/ros2-bridge/msg-gen/src/types/package.rs

GitHub Actions / Examples (macos-latest)

unused variable: `gen_cxx_bridge`

Check warning on line 129 in libraries/extensions/ros2-bridge/msg-gen/src/types/package.rs

GitHub Actions / Examples (macos-latest)

unused variable: `gen_cxx_bridge`

Check warning on line 129 in libraries/extensions/ros2-bridge/msg-gen/src/types/package.rs

GitHub Actions / ROS2 Bridge Examples

unused variable: `gen_cxx_bridge`

Check warning on line 129 in libraries/extensions/ros2-bridge/msg-gen/src/types/package.rs

GitHub Actions / ROS2 Bridge Examples

unused variable: `gen_cxx_bridge`

Check warning on line 129 in libraries/extensions/ros2-bridge/msg-gen/src/types/package.rs

GitHub Actions / ROS2 Bridge Examples

unused variable: `gen_cxx_bridge`

Check warning on line 129 in libraries/extensions/ros2-bridge/msg-gen/src/types/package.rs

GitHub Actions / ROS2 Bridge Examples

unused variable: `gen_cxx_bridge`

Check warning on line 129 in libraries/extensions/ros2-bridge/msg-gen/src/types/package.rs

GitHub Actions / Examples (ubuntu-latest)

unused variable: `gen_cxx_bridge`

Check warning on line 129 in libraries/extensions/ros2-bridge/msg-gen/src/types/package.rs

GitHub Actions / Examples (ubuntu-latest)

unused variable: `gen_cxx_bridge`

Check warning on line 129 in libraries/extensions/ros2-bridge/msg-gen/src/types/package.rs

GitHub Actions / Test (windows-latest)

unused variable: `gen_cxx_bridge`

Check warning on line 129 in libraries/extensions/ros2-bridge/msg-gen/src/types/package.rs

GitHub Actions / Test (windows-latest)

unused variable: `gen_cxx_bridge`

Check warning on line 129 in libraries/extensions/ros2-bridge/msg-gen/src/types/package.rs

GitHub Actions / Test (windows-latest)

unused variable: `gen_cxx_bridge`

Check warning on line 129 in libraries/extensions/ros2-bridge/msg-gen/src/types/package.rs

GitHub Actions / Examples (windows-latest)

unused variable: `gen_cxx_bridge`

Check warning on line 129 in libraries/extensions/ros2-bridge/msg-gen/src/types/package.rs

GitHub Actions / Examples (windows-latest)

unused variable: `gen_cxx_bridge`
let services_block = self.services_block();
let actions_block = self.actions_block();
pub fn get_string_literal_parser(
string_type: GenericString,
) -> Box<dyn FnMut(&str) -> IResult<&str, String>> {

Check warning on line 112 in libraries/extensions/ros2-bridge/msg-gen/src/parser/literal.rs

GitHub Actions / Clippy

very complex type used. Consider factoring parts into `type` definitions
match string_type {
GenericString::String | GenericString::WString => Box::new(string_literal),
GenericString::BoundedString(max_size) | GenericString::BoundedWString(max_size) => {
opt(delimited(char('['), usize_literal, char(']'))),
peek(alt((space1, eof))),
)),
|(value_type, size, _)| match size {

Check warning on line 57 in libraries/extensions/ros2-bridge/msg-gen/src/parser/types.rs

GitHub Actions / Clippy

use Option::map_or_else instead of an if let/else
None => value_type.into(),
Some(size) => PrimitiveArray { value_type, size }.into(),
},
impl ConstantType {
pub fn type_tokens(&self) -> impl ToTokens {
match self {
ConstantType::PrimitiveType(t) => {

Check warning on line 28 in libraries/extensions/ros2-bridge/msg-gen/src/types/constant.rs

GitHub Actions / Clippy

unnecessary structure name repetition
let token = t.type_tokens();
quote! { #token }
}
ConstantType::PrimitiveArray(t) => {

Check warning on line 32 in libraries/extensions/ros2-bridge/msg-gen/src/types/constant.rs

GitHub Actions / Clippy

unnecessary structure name repetition
let token = t.type_tokens();
quote! { #token }
}
let _build = cxx_build::bridge(&target_file);
}
fn ament_prefix_paths() -> Vec<PathBuf> {

Check warning on line 23 in libraries/extensions/ros2-bridge/build.rs

GitHub Actions / CLI Test (ubuntu-latest)

function `ament_prefix_paths` is never used

Check warning on line 23 in libraries/extensions/ros2-bridge/build.rs

GitHub Actions / Examples (macos-latest)

function `ament_prefix_paths` is never used

Check warning on line 23 in libraries/extensions/ros2-bridge/build.rs

GitHub Actions / Examples (macos-latest)

function `ament_prefix_paths` is never used

Check warning on line 23 in libraries/extensions/ros2-bridge/build.rs

GitHub Actions / CLI Test (macos-latest)

function `ament_prefix_paths` is never used

Check warning on line 23 in libraries/extensions/ros2-bridge/build.rs

GitHub Actions / CLI Test (windows-latest)

function `ament_prefix_paths` is never used

Check warning on line 23 in libraries/extensions/ros2-bridge/build.rs

GitHub Actions / ROS2 Bridge Examples

function `ament_prefix_paths` is never used

Check warning on line 23 in libraries/extensions/ros2-bridge/build.rs

GitHub Actions / ROS2 Bridge Examples

function `ament_prefix_paths` is never used

Check warning on line 23 in libraries/extensions/ros2-bridge/build.rs

GitHub Actions / Examples (ubuntu-latest)

function `ament_prefix_paths` is never used

Check warning on line 23 in libraries/extensions/ros2-bridge/build.rs

GitHub Actions / Examples (ubuntu-latest)

function `ament_prefix_paths` is never used

Check warning on line 23 in libraries/extensions/ros2-bridge/build.rs

GitHub Actions / Examples (windows-latest)

function `ament_prefix_paths` is never used

Check warning on line 23 in libraries/extensions/ros2-bridge/build.rs

GitHub Actions / Examples (windows-latest)

function `ament_prefix_paths` is never used
let ament_prefix_path: String = match std::env::var("AMENT_PREFIX_PATH") {
Ok(path) => path,
Err(std::env::VarError::NotPresent) => {