Skip to content

Commit

Permalink
feat: basic ipython support (#353)
Browse files Browse the repository at this point in the history
  • Loading branch information
morgante authored May 25, 2024
1 parent a4d22eb commit 0c8cb69
Show file tree
Hide file tree
Showing 41 changed files with 1,738 additions and 514 deletions.
2 changes: 1 addition & 1 deletion crates/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ uuid = { version = "1.1", features = ["v4", "serde"] }
tokio = { version = "1", features = ["full"] }
chrono = { version = "0.4.26", features = ["serde"] }
reqwest = { version = "0.11", features = ["json", "stream"] }
futures-util = "0.3.30"
futures-util = { version = "0.3.30" }
lazy_static = { version = "1.4.0" }
indicatif-log-bridge = { version = "0.2.1" }
colored = { version = "2.0.4" }
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/src/commands/patterns_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use marzano_gritmodule::config::{DefinitionSource, ResolvedGritDefinition};
use crate::{
flags::GlobalFormatFlags,
lister::{list_applyables, Listable},
resolver::{resolve_from_flags_or_cwd},
resolver::resolve_from_flags_or_cwd,
};

use super::list::ListArgs;
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/src/github.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use crate::analyze::group_checks;
use crate::ux::CheckResult;
use anyhow::{Context as _, Result};
use fs_err::OpenOptions;
use grit_util::Range;
use log::info;
use marzano_core::{api::EnforcementLevel, fs::extract_ranges};
use marzano_gritmodule::config::ResolvedGritDefinition;
use marzano_gritmodule::utils::extract_path;
use fs_err::OpenOptions;
use std::io::prelude::*;

fn format_level(level: &EnforcementLevel) -> String {
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/src/result_formatting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use anyhow::anyhow;
use colored::Colorize;
use console::style;
use core::fmt;
use fs_err::read_to_string;
use log::info;
use marzano_core::api::{
AllDone, AnalysisLog, CreateFile, DoneFile, FileMatchResult, InputFile, Match, MatchResult,
Expand All @@ -10,7 +11,6 @@ use marzano_core::api::{
use marzano_core::constants::DEFAULT_FILE_NAME;
use marzano_messenger::output_mode::OutputMode;
use std::fmt::Display;
use fs_err::read_to_string;
use std::{
io::Write,
sync::{Arc, Mutex},
Expand Down
35 changes: 35 additions & 0 deletions crates/cli_bin/fixtures/notebooks/old_nb.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "5e3cb542-933d-4bf3-a82b-d9d6395a7832",
"metadata": {
"tags": []
},
"outputs": [],
"source": ["print(4)\n", "print(\"3\")\n", "print(5)"]
}
],
"metadata": {
"kernelspec": {
"display_name": "conda210",
"language": "python",
"name": "conda210"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.16"
}
},
"nbformat": 2,
"nbformat_minor": 5
}
40 changes: 40 additions & 0 deletions crates/cli_bin/fixtures/notebooks/other_nb.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "5e3cb542-933d-4bf3-a82b-d9d6395a7832",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"import configparser\n",
"\n",
"config = configparser.ConfigParser()\n",
"config.read(\"./secrets.ini\")"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "conda210",
"language": "python",
"name": "conda210"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.16"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
11 changes: 11 additions & 0 deletions crates/cli_bin/fixtures/notebooks/pattern.grit
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
language python

or {
// Simple replacement
`configparser.ConfigParser()` => `FigParser.Fig()`,
// Cross-cell references
`Tool($args)` => `Fool($args)` where {
$program <: contains `from langchain.agents import $_`
},
`print($x)` => `flint($x)`
}
39 changes: 39 additions & 0 deletions crates/cli_bin/fixtures/notebooks/tiny_nb.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "5e3cb542-933d-4bf3-a82b-d9d6395a7832",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"print(4)\n",
"print(\"3\")\n",
"print(5)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "conda210",
"language": "python",
"name": "conda210"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.16"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading

0 comments on commit 0c8cb69

Please sign in to comment.