RustImplementation #25

Merged
mysticmomba merged 13 commits from RustImplementation into master 2025-11-07 11:39:51 -05:00
6 changed files with 9 additions and 9 deletions
Showing only changes of commit 8c44de204d - Show all commits
+1 -1
View File
@@ -2,7 +2,7 @@ name: Build Library
run-name: ${{ gitea.actor }} run-name: ${{ gitea.actor }}
on: on:
push: push:
braches: branches:
- RustImplementation - RustImplementation
paths: paths:
- airlock_libs/** - airlock_libs/**
+1 -1
View File
@@ -17,7 +17,7 @@ dependencies = [
[[package]] [[package]]
name = "airlock_libs" name = "airlock_libs"
version = "1.0.3" version = "2.0.0"
dependencies = [ dependencies = [
"chrono", "chrono",
"indicatif", "indicatif",
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "airlock_libs" name = "airlock_libs"
version = "1.0.3" version = "2.0.0"
edition = "2024" edition = "2024"
[lib] [lib]
+1 -1
View File
@@ -4,7 +4,7 @@ build-backend = "maturin"
[project] [project]
name = "airlock_libs" name = "airlock_libs"
version = "1.0.3" version = "2.0.0"
description = "Airlock Digital API Wrapper" description = "Airlock Digital API Wrapper"
readme = "README.md" readme = "README.md"
license = { text = "AGPL-3.0-only" } license = { text = "AGPL-3.0-only" }
+4 -4
View File
@@ -13,7 +13,7 @@ use std::{
env, env,
fmt::Write, fmt::Write,
fs::{self, File}, fs::{self, File},
io::Read, io::{Read, Seek, SeekFrom},
path::PathBuf, path::PathBuf,
str::FromStr, str::FromStr,
}; };
@@ -96,7 +96,9 @@ pub fn pull_policy_exec_histories(
let client = build_client(py, &py_self); let client = build_client(py, &py_self);
let api: Py<PyAny> = py_self; let api: Py<PyAny> = py_self;
let cutoff = Local::now().naive_local() - Duration::days(days); let cutoff = Local::now().naive_local() - Duration::days(days);
let mut f = File::open(&writeable_filepath).unwrap();
loop { loop {
f.seek(SeekFrom::Start(0)).unwrap();
let execution_histories = history_logging( let execution_histories = history_logging(
py, py,
&api, &api,
@@ -110,7 +112,6 @@ pub fn pull_policy_exec_histories(
break; break;
} }
let mut seen: HashMap<(String, String, String), Group> = if writeable_filepath.exists() { let mut seen: HashMap<(String, String, String), Group> = if writeable_filepath.exists() {
let mut f = File::open(&writeable_filepath).unwrap();
let mut contents = String::new(); let mut contents = String::new();
f.read_to_string(&mut contents).unwrap(); f.read_to_string(&mut contents).unwrap();
let existing_data: ApiResponse = let existing_data: ApiResponse =
@@ -177,8 +178,7 @@ pub fn pull_policy_exec_histories(
) )
{ {
let date_diff = Local::now().naive_local().date() - last_date; let date_diff = Local::now().naive_local().date() - last_date;
let percentage_diff = let percentage_diff = (days - date_diff.num_days()) as f64 / days as f64 * 100.0;
((days + 10) - date_diff.num_days()) as f64 / (days + 10) as f64 * 100.0;
progress_bar.set_position(percentage_diff.round() as u64); progress_bar.set_position(percentage_diff.round() as u64);
progress_bar.set_message("Total Percent Complete"); progress_bar.set_message("Total Percent Complete");
} }
+1 -1
View File
@@ -10,4 +10,4 @@ tqdm==4.67.1
urllib3==2.5.0 urllib3==2.5.0
--extra-index-url https://git.racooncity.org/api/packages/brotoskyj/pypi/simple/ --extra-index-url https://git.racooncity.org/api/packages/brotoskyj/pypi/simple/
airlock_libs==1.0.3 airlock_libs==2.0.0