From cb662ac469a9c8164967c79c81457be71d789ec5 Mon Sep 17 00:00:00 2001 From: Albert Garde Date: Sun, 28 Jan 2024 14:32:42 +0100 Subject: [PATCH] :rotating_light: Make clippy happy --- .github/workflows/pre-merge.yml | 2 +- python/deepdecipher/__init__.py | 10 +++++----- src/data/retrieve/neuroscope.rs | 2 +- src/server/service_providers/service_provider.rs | 14 +++++++------- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/pre-merge.yml b/.github/workflows/pre-merge.yml index 689c9c1..b0c4530 100644 --- a/.github/workflows/pre-merge.yml +++ b/.github/workflows/pre-merge.yml @@ -9,7 +9,7 @@ env: RUSTFLAGS: "-Dwarnings" jobs: - build: + rust: runs-on: ubuntu-latest diff --git a/python/deepdecipher/__init__.py b/python/deepdecipher/__init__.py index c6dc19a..933c2a8 100644 --- a/python/deepdecipher/__init__.py +++ b/python/deepdecipher/__init__.py @@ -1,14 +1,14 @@ from .deepdecipher import ( - log_init, - start_server, Database, + DataType, + DataTypeHandle, + Index, ModelHandle, ModelMetadata, - DataTypeHandle, - DataType, ServiceHandle, ServiceProvider, - Index, + log_init, + start_server, ) deepdecipher.setup_keyboard_interrupt() diff --git a/src/data/retrieve/neuroscope.rs b/src/data/retrieve/neuroscope.rs index 60078d0..01b2a2b 100644 --- a/src/data/retrieve/neuroscope.rs +++ b/src/data/retrieve/neuroscope.rs @@ -58,7 +58,7 @@ async fn scrape_neuron_page_to_database( let model_name = model.name(); let first_text = page .texts() - .get(0) + .first() .with_context(|| format!("Failed to get first text from neuroscope page for neuron {neuron_index} in model '{model_name}'."))?; let activation_range = first_text.max_activation() - first_text.min_activation(); diff --git a/src/server/service_providers/service_provider.rs b/src/server/service_providers/service_provider.rs index b6b7e4b..0af946e 100644 --- a/src/server/service_providers/service_provider.rs +++ b/src/server/service_providers/service_provider.rs @@ -1,6 +1,6 @@ use std::{future::Future, pin::Pin}; -use anyhow::{bail, Context, Result}; +use anyhow::{anyhow, Context, Result}; use async_trait::async_trait; use delegate::delegate; use serde::{Deserialize, Serialize}; @@ -46,11 +46,11 @@ pub trait ServiceProviderTrait: Clone + Serialize + Deserialize<'static> + Send query: &serde_json::Value, model_handle: &ModelHandle, ) -> Result { - bail!( + Err(anyhow!( "No model data exists for service '{}' for model '{}'.", service_name, model_handle.name() - ); + )) } async fn layer_object( @@ -61,11 +61,11 @@ pub trait ServiceProviderTrait: Clone + Serialize + Deserialize<'static> + Send model_handle: &ModelHandle, layer_index: u32, ) -> Result { - bail!( + Err(anyhow!( "No layer data exists for service '{}' for model '{}'.", service_name, model_handle.name() - ); + )) } async fn neuron_object( @@ -77,11 +77,11 @@ pub trait ServiceProviderTrait: Clone + Serialize + Deserialize<'static> + Send layer_index: u32, neuron_index: u32, ) -> Result { - bail!( + Err(anyhow!( "No neuron data exists for service '{}' for model '{}'.", service_name, model_handle.name() - ); + )) } async fn model_binary(